gupalo / browser-notifier
Extension of Symfony Notifier for browsers
Installs: 16 216
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- psr/log: >=1.1
- symfony/notifier: ^5.4|^6.0|^7.0
- twig/twig: ^3.3
Requires (Dev)
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^10.0
README
Simple use of Symfony Notifier.
Install
Composer
composer require gupalo/browser-notifier
Create config/packages/browser_notifier.yaml
imports:
- {resource: '../../vendor/gupalo/browser-notifier/config/services.yaml'}
Usage
Controller
public function ...(..., BrowserNotifier $notifier): Response
{
...
$notifier->send('Something');
$notifier->success('Something');
$notifier->warning('Something');
$notifier->error('Something');
...
}
Twig
{{ app.request.hasPreviousSession ? app.flashes('notification')|browser_notifications|raw : '' }}
Use BrowserLogger
as logger implementing LoggerInterface
.