asmitta-01 / toast-bundle
UX Toast display for your Symfony project.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/asmitta-01/toast-bundle
Requires
- php: >=8.1
- symfony/config: ^6.0 || ^7.0
- symfony/dependency-injection: ^6.0 || ^7.0
- symfony/event-dispatcher: ^6.0 || ^7.0
- symfony/framework-bundle: ^6.0 || ^7.0
- symfony/http-foundation: ^6.0 || ^7.0
- symfony/http-kernel: ^6.0 || ^7.0
- symfony/options-resolver: ^6.0 || ^7.0
- symfony/security-core: ^6.0 || ^7.0
- symfony/translation: ^6.0 || ^7.0
- symfony/validator: ^6.0 || ^7.0
- symfony/yaml: ^6.0 || ^7.0
Requires (Dev)
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.12
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-strict-rules: ^1.1
- phpstan/phpstan-symfony: ^1.4
- phpunit/phpunit: ^9.5
- symfony/browser-kit: ^6.0 || ^7.0
- symfony/css-selector: ^6.0 || ^7.0
- symfony/mime: ^6.0 || ^7.0
- symfony/phpunit-bridge: ^7.0
- symfony/security-bundle: ^6.0 || ^7.0
- symfony/twig-bundle: ^6.0 || ^7.0
This package is auto-updated.
Last update: 2025-10-07 01:58:55 UTC
README
A Symfony bundle for displaying Bootstrap toast messages from flash messages.
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
composer require asmitta-01/toast-bundle
Configuration
Enable the bundle in config/bundles.php
:
return [ // ... Asmitta\ToastBundle\AsmittaToastBundle::class => ['all' => true], ];
Usage
1. Add flash messages in your controller
use Asmitta\ToastBundle\Enum\ToastType; public function someAction(Request $request): Response { $this->addFlash('success', 'Operation completed successfully!'); // 'success' or ToastType::SUCCESS->value $this->addFlash('warning', 'Please check your input.'); $this->addFlash('error', 'Something went wrong.'); $this->addFlash('info', 'Here is some information.'); return $this->render('your_template.html.twig'); }
2. Include Bootstrap CSS and JS in your template
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
3. Add the toast function to your template
{{ render_toasts() }}
Toast Types
The bundle supports these flash message types:
success
→ Green toastwarning
→ Yellow toasterror
ordanger
→ Red toastinfo
(default) → Light Blue toast
Features
- Automatic mapping of flash message types to Bootstrap toast variants
- Auto-hide after 5 seconds
- Positioned at top-right corner
- Responsive design
- No additional configuration required