Symfony adapter for PHPFlasher Toastr. Seamlessly integrate Toastr notifications into Symfony applications.
- PHP >= 8.2
- Symfony >= 7.0
- php-flasher/flasher-symfony ^2.4.0
- php-flasher/flasher-toastr ^2.4.0
composer require php-flasher/flasher-toastr-symfony// Global helper
toastr('Your changes have been saved!');
// In controller
public function save(): RedirectResponse
{
// Your logic...
toastr('Operation completed successfully!');
return $this->redirectToRoute('home');
}
// With options
toastr('Success message', [
'timeOut' => 5000,
'positionClass' => 'toast-top-right',
]);- Symfony Helper:
toastr()global function - Service Injection:
ToastrFactoryautowired in constructors - Twig Integration: Auto-injects assets in Twig templates
- Flash Bag: Converts Symfony flash messages to Toastr notifications
Publish configuration:
php bin/console flasher:install --configAdd to config/packages/flasher.yaml:
flasher:
toastr:
options:
timeOut: 5000
progressBar: true
positionClass: toast-top-rightComplete documentation: php-flasher.io