Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Lightweight Event dispatcher library compatible with PSR container

License

NotificationsYou must be signed in to change notification settings

antidot-framework/antidot-event-dispatcher

Scrutinizer Code QualityCode CoverageInfection MSIType CoverageBuild StatusMaintainability

Psr 14 Event dispatcher implementation.

Installation

Usingcomposer

composer require antidot-fw/event-dispatcher

it install the library automatically

install

Using factory:

Config

<?php/** @var \Psr\Container\ContainerInterface $container */$container->set('config', ['app-events' => ['event-listeners' => [//            SomeEvent::class => ['some.event' => [                SomeEventListener::class,                SomeEventOtherListener::class,            ]        ]    ]]);

factory

<?phpuseAntidot\Event\Container\EventDispatcherFactory;usePsr\EventDispatcher\EventDispatcherInterface;$factory =newEventDispatcherFactory();$eventDispatcher =$factory->__invoke($container);$container->set(EventDispatcherInterface::class,$eventDispatcher);

Async Event Dispatcher Factory

composer require react/event-loop
<?phpuseAntidot\Event\Container\AsyncEventDispatcherFactory;usePsr\EventDispatcher\EventDispatcherInterface;$factory =newAsyncEventDispatcherFactory();$eventDispatcher =$factory->__invoke($container);$container->set(EventDispatcherInterface::class,$eventDispatcher);

Usage

Send events

<?phpusePsr\EventDispatcher\EventDispatcherInterface;/** @var \Psr\Container\ContainerInterface $container */$eventDispatcher =$container->get(EventDispatcherInterface::class);$eventDispatcher->dispatch(SomeEvent::occur());

Send events Async mode

<?phpusePsr\EventDispatcher\EventDispatcherInterface;useReact\EventLoop\Loop;/** @var \Psr\Container\ContainerInterface $container */$eventDispatcher =$container->get(EventDispatcherInterface::class);$eventDispatcher->dispatch(SomeEvent::occur());Loop::run()

About

Lightweight Event dispatcher library compatible with PSR container

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp