Skip to content

nreynis/notification-bundle

 
 

Repository files navigation

mgilet/notification-bundle

An easy yet powerful notification bundle for Symfony

Latest Stable Version Latest Unstable Version Total Downloads License

SensioLabsInsight

mgilet/notificationBundle

Create and manage notifications in an efficient way.

Symfony support :

  • 2.7.x
  • 2.8.x
  • 3.x

Features

  • Easy setup
  • Easy to use
  • Powerful notification management
  • Simple Twig render methods
  • Fully customizable
  • Multiple notifiables entities
  • No bloated dependencies (little requirements)

Notice: Only Doctrine ORM is supported for now.

Installation & usage

Installation

This bundle is available on packagist.

First :

$ composer require mgilet/notification-bundle

See documentation for next steps

Basic usage

class MyController extends Controller
{

    ...

    public function sendNotification(Request $request)
    {
       $manager = $this->get('mgilet.notification');
      $notif = $manager->createNotification('Hello world !');
      $notif->setMessage('This a notification.');
      $notif->setLink('http://symfony.com/');
      // or the one-line method :
      // $manager->createNotification('Notification subject','Some random text','http://google.fr');

      // you can add a notification to a list of entities
      // the third parameter `$flush` allows you to directly flush the entities
      $manager->addNotification(array($this->getUser()), $notif, true);
      
      ...
    }

See HERE for more

Translations

For now this bundle is only translated to de, en, es, fr, it.

Help me improve this by submitting your translations.

Community

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.

Licence

MIT

Packages

No packages published

Languages

  • PHP 98.2%
  • HTML 1.8%