buzzingpixel / corbomite-events
Corbomite Events
Requires
- php: >=7.2
- buzzingpixel/corbomite-config-collector: ^1.0
- buzzingpixel/corbomite-di: ^1.0
- buzzingpixel/request-data-store: ^1.0.1
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.26.2
- doctrine/coding-standard: ^6.0
- friendsofphp/php-cs-fixer: ^2.14
- phpmd/phpmd: ^2.6
- phpunit/phpunit: ^8.1
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.4
- symfony/var-dumper: ^4.2
This package is auto-updated.
Last update: 2024-09-07 15:02:40 UTC
README
作为BuzzingPixel的Corbomite项目的一部分。
提供事件注册和派发。
使用方法
监听事件
当调用派发器时,它首先启动一个收集器服务,该服务将加载任何事件。您可以通过在composer.json的extra
对象中设置eventCollectorConfigFilePath
键来在您的应用程序或任何composer包中注册事件。这应该是一个调用PHP文件的路径。被调用的PHP文件将有一个名为$eventListenerRegistration
的变量可用。这是一个\corbomite\events\interfaces\EventListenerRegistrationInterface
的实例,它将允许您注册事件。
监听器必须实现接口 \corbomite\events\interfaces\EventListenerInterface
。
派发事件
要派发事件,从DI获取\corbomite\events\EventDispatcher
并调用dispatch
,发送您希望派发的事件类的实例。该事件类实例必须实现\corbomite\events\interfaces\EventInterface
。
许可证
版权所有 2019 BuzzingPixel, LLC
根据Apache许可证版本2.0(“许可证”)授权;除非遵守许可证规定,否则不得使用此文件。您可以在https://apache.ac.cn/licenses/LICENSE-2.0获取许可证副本。
除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”基础分发,不提供任何形式的保证或条件,无论是明示的还是暗示的。有关许可证的具体语言、权限和限制,请参阅许可证。