emaia / laravel-hotwire-turbo
Hotwire Turbo with Laravel
Fund package maintenance!
Emaia
Requires
- php: ^8.2
- illuminate/http: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
- illuminate/view: *
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9|^3.1
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1
- orchestra/testbench: ^9.0|^10.0
- orchestra/workbench: ^9.0|^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^2.0.1
- phpstan/phpstan-phpunit: ^2.0.0
README
The purpose of this package is to facilitate the use of Turbo (Hotwire) in a Laravel app.
Installation
You can install the package via composer:
composer require emaia/laravel-turbo
Usage
/* Some controller method... */ public function update(Request $request) { /* ... */ if (request()->wasFromTurboFrame('modal')) { $streamCollection = new StreamCollection([ new Stream( Action::PREPEND, 'flash-container', view('components.flash-message', [ 'hasSuccess' => true, 'message' => $successMessage, ]) ), new Stream( Action::UPDATE, 'modal', '' ), ]); return response()->turboStream( $streamCollection ); } return redirect()->back()->with('success', $successMessage); }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.