A simple Symfony bundle to notify user
Create and manage user notifications in an efficient way.
Symfony support :
- 2.7.x
- 2.8.x
- 3.x
Bootstrap > 3.x highly recommended
- Easy notification management
- Simple Twig render method
- Pretty Twig template (dropdown using Bootstrap 3)
- Fully customizable
- Easy setup
- No bloated dependencies (little requirements)
Notice: Only Doctrine ORM is supported for now.
This bundle is available on packagist.
Notice : The bundle is actually in alpha state (no major issue encountered)
In order to install it, add the following line in your composer.json
// composer.json
...
"require": {
"mgilet/notification-bundle": "dev-master",
},
Then perform a
$ composer install
This will install the latest commited version of the master branch.
When a stable version will come out you will just have to enter the following command:
$ composer require mgilet/notification-bundle
See documentation for next steps
class DefaultController extends Controller
{
...
/**
* @Route("/send-notification", name="send_notification")
* @param Request $request
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function sendNotification(Request $request)
{
$manager = $this->get('mgilet.notification');
$notif = $manager->generateNotification('Hello world !');
$notif
->setMessage('This a notification.')
->setLink('http://symfony.com/');
$manager->addNotification($this->getUser(), $notif);
// or the one-line method :
// $manager->createNotification($this->getUser(), 'Notification subject','Some random text','http://google.fr');
return $this->redirectToRoute('homepage');
}
See HERE for more
For now this bundle is only translated to de, en, es, fr, it.
Help me improve this by submitting your translations.
You can help make this bundle better by contributing (every pull request will be considered) or submitting an issue.
Enjoy and share if you like it.
MIT