2017 © Pedro Peláez
 

library event

image

xervice/event

  • Friday, July 27, 2018
  • by mibexx
  • Repository
  • 1 Watchers
  • 0 Stars
  • 65 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Event

Build Status Scrutinizer Code Quality Code Coverage, (*1)

Installation

composer require xervice/event

Configuration

You can fire events without configuring them. But you must define listener, to handle fired events. To do that, you have to define them in the EventDependencyProvider., (*2)

<?php


namespace App\Event;


use Xervice\Event\EventDependencyProvider as XerviceEventDependencyProvider;
use XerviceTest\Event\Listener\TestListener;

class EventDependencyProvider extends XerviceEventDependencyProvider
{
    protected function getListener(): array
    {
        return [
            'test' => [
                TestListener::class //implemente EventListenerInterface
            ]
        ];
    }

}

The EventProvider provide a new event to the target system. In the DefaultEventProvider the events are directly routed to the ListenerProvider. If you want to change the DefaultEventProvider, you can overwrite it in the EventFactory in the method createEventProvider., (*3)

    /**
     * @return \Xervice\Event\Business\Provider\EventProviderInterface
     */
    public function createEventProvider(): EventProviderInterface
    {
        return new DefaultEventProvider(
            $this->createListenerProvider()
        );
    }

The listener provider provide the events to the listener., (*4)

Using

You can fire new Event over the event facade:, (*5)

    $newEventContent = new OwnDataProvider(); // DataProviderInterface
    $newEventContent->setData('MyTest');

    $event = new EventDataProvider();
    $event
        ->setName('MY_EVENT_NAME')
        ->setMessage($newEvent);

    $eventFacade->fireEvent($event);

The Versions

27/07 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

27/07 2018

2.1.0

2.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

27/07 2018

2.0.0

2.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

27/07 2018

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram