2017 © Pedro Peláez
 

library store-notifier

PHP notifier based on Symfony EventDispatcher. Sends notification(s) when events are fired. Provides file storage to keep tracks of notifications.

image

wooshell/store-notifier

PHP notifier based on Symfony EventDispatcher. Sends notification(s) when events are fired. Provides file storage to keep tracks of notifications.

  • Saturday, August 3, 2013
  • by wooshell
  • Repository
  • 0 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Store Notifier

PHP notifier based on Symfony EventDispatcher., (*1)

  • Sends notification(s) when events are fired.
  • Provides file storage to keep tracks of notifications.

Installation

$ composer install --dev

Store usage

Store registration:, (*2)

use wooshell\storeNotifier\StoreNotifier;

$myStoreDir = '/tmp/myStoreDir';
$myStore = 'cars';
$myStoreEntry = 'Smart Hayabusa';

$storeNotifier = new StoreNotifier($myStoreDir);

$storeNotifier->store($myStore);
$storeNotifier->store(...);

$store->log($myStoreEntry);

Store notification:, (*3)

if (false === $store->exists($myStore, $myStoreEntry)) {
    $summary = '...';
    $body = '...';
    $store->send($summary, $body);
}

Store locking:, (*4)

$lockFilepath = '/tmp/storeNotifier.lock';
$store->lock($lockFilepath );
...
$store->unlock($lockFilepath );

Custom Notification

Create a listener:, (*5)

use Symfony\Component\EventDispatcher\Event;
use wooshell\storeNotifier\EventDispatcher\Events\SendEvent;
use wooshell\storeNotifier\EventDispatcher\Listeners\ListenerInterface;

class EchoListener implements ListenerInterface
{
    /**
     * @param Event $event
     */
    public function send(Event $event)
    {
        /** @var SendEvent $event */
        echo($event->getSummary(), $event->getBody()));
    }
}

Add a listener into the store notifier:, (*6)

$store->getDispatcher()->addListener(SendEvent::EVENT_SEND, array(new EchoListener() , 'send'));

The Versions

03/08 2013

dev-master

9999999-dev

PHP notifier based on Symfony EventDispatcher. Sends notification(s) when events are fired. Provides file storage to keep tracks of notifications.

  Sources   Download

MIT

The Requires

 

by William Garcia

dispatcher event notification store