lemonsqueezy / plain-ui-components
Plain UI Components for Laravel
Installs: 15 258
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 2
Forks: 5
Open Issues: 0
Requires
- php: ~8.1.0|~8.2.0|~8.3.0|~8.4.0
- illuminate/http: ^8.83|^9.33|^10.0|^11.3
- illuminate/support: ^8.83|^9.33|^10.0|^11.3
Requires (Dev)
- nunomaduro/larastan: ^1.0|^2.0
- orchestra/testbench: ^6.0|^7.0|^8.2|^9.0
- phpunit/phpunit: ^9.5.10|^10.1|^11.3.6
- roave/security-advisories: dev-latest
README
A Laravel-based library to easily build Plain UI component cards.
Requirements
- PHP 8.1 or higher
- Laravel 8.83 or higher
Installation
Install the package with composer:
composer require lemonsqueezy/plain-ui-components
Usage
/** * An Plain Customer Card endpoint * * @link https://docs.plain.com/adding-context/customer-cards */ public function customerCards(Request $request) { abort_unless($email = $request->input('customer.email'), 400, 'No email provided.'); $user = User::where('email', $email)->firstOrFail(); return Cards::make() // Adding a card directly is easy, but the data is not guaranteed to be used by Plain. ->add(Card::make('platform-details')->add(Text::make('Platform Version: '.config('app.version'))) // As an alternative, you can therefore use a binding, which lazily resolves // only when the request asks for that card, making it way more efficient. ->bind('user-details', fn (Card $card) => $this->buildUserDetailsCard($card, $user)) // Finally, we'll render the cards payload using the JSON Request made by Plain. ->toArray($request); }
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email hello@lemonsqueezy.com instead of using the issue tracker.
This way, we can safely discuss and resolve the issue (within a reasonable timeframe), without exposing users to the unnecessary additional risk. Once the issue is fixed and a new version is released, we'll make sure to credit you for your contribution (unless you wish to remain anonymous).
License
The MIT License (MIT). Please see License File for more information.