2017 © Pedro Peláez
 

symfony-bundle notificationbundle

Simple Notification Bundle For Symfony

image

sshversioncontrol/notificationbundle

Simple Notification Bundle For Symfony

  • Friday, June 2, 2017
  • by SSHVersionControl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Simple Notification Bundle Build Status

Installation

To use this bundle in your Symfony project add the following to your composer.json:, (*1)

{
    "require": {
        // ...
        "": "dev-master"
    }
}

and enable it in your kernel:, (*2)

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new GitSSH2\NotificationBundle\GitSSH2NotificationBundle(),
    );
}

Configuration

If you want to use the default system handle which stores the notifications in the database you will need to update the database, (*3)

    php bin/console doctrine:schema:update --force

The default configuration is to use system handler. You can create you own handlers and register them., (*4)

    gitssh2.notification.manager:
        class: GitSSH2\NotificationBundle\Notification\Manager\NotificationManager
        arguments: [["@gitssh2.notification.handler.system"]]

Usage

This bundle is a bases for a simple notification system. To trigger and notification you just need to use Symfony's event dispatcher e.g., (*5)

<?php

    $notification = new Notification();
    $notification->setTitle('Hello');
    $notification->setMessage('Welcome message');
    ...

    $notifcationEvent = new NotificationEvent($notification);
    $dispatcher = $this->get('event_dispatcher');
    $dispatcher->dispatch($notifcationEvent::NAME, $notifcationEvent);

It is advised to use your own notification entity. All you need to do is implement GitSSH2\NotificationBundle\Notification\NotificationEntityInterface, (*6)

You also should implement your own notification handlers. For example you could create a email handler., (*7)

Code example to follow, (*8)

The Versions