php-flasher/flasher-toastr-laravel
Composer 安装命令:
composer require php-flasher/flasher-toastr-laravel
包简介
Leverage Toastr for stylish toast notifications in Laravel with PHPFlasher. Add Toastr's sleek notifications to your Laravel projects effortlessly.
关键字:
README 文档
README
Laravel adapter for PHPFlasher Toastr. Seamlessly integrate Toastr notifications into Laravel applications.
Requirements
- PHP >= 8.2
- Laravel >= 11.0
- php-flasher/flasher-laravel ^2.4.0
- php-flasher/flasher-toastr ^2.4.0
Installation
composer require php-flasher/flasher-toastr-laravel
Quick Start
// Global helper toastr()->success('Operation completed successfully!'); toastr()->error('An error occurred.'); toastr()->info('Information message.'); toastr()->warning('Warning message.'); // In controller public function save(Request $request) { // Your logic... toastr()->success('Changes saved!'); return redirect()->back(); } // With options toastr()->success('Success message', [ 'timeOut' => 5000, 'positionClass' => 'toast-top-right', ]);
Features
- Laravel Facade:
toastr()global helper - Dependency Injection:
ToastrFactorytype-hinted injection - Laravel Integration: Auto-injects assets in Blade templates
- Flash Bag: Converts Laravel flash messages to Toastr notifications
Configuration
Publish configuration:
php artisan flasher:install --config
Add to config/flasher.php:
return [ 'plugins' => [ 'toastr' => [ 'options' => [ 'timeOut' => 5000, 'progressBar' => true, 'positionClass' => 'toast-top-right', ], ], ], ];
Documentation
Complete documentation: php-flasher.io
License
统计信息
- 总下载量: 618.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 15
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-06