Download the PHP package phower/events without Composer
On this page you can find all versions of the php package phower/events. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phower/events
More information about phower/events
Files in phower/events
Informations about the package events
Phower Events
Events oriented programming for PHP.
Requirements
Phower Events requires:
Instalation
Add Phower Events to any PHP project using Composer:
Usage
This package provides an event-oriented mechanism which allows any PHP application to implement a way for separated parts to communicate with each other by dispatching events and listening to them.
An implementation of PhowerEvents requires an EventHandler class and at least an event listener which must be any valud PHP callable:
Note that any listener method should always expect two arguments:
- An instance of
EventInterface
, representing the event triggered;- An intance of
EventHandlerInterface
, the handler which have triggered that event.
Before being able to trigger the listner above we must to attach it to an handler instance:
Container aware handlers
When a Container is part of an application it may be useful to automatically pass it across the listeners.
For this situation we can switch to an instance of ContainerAwareEventHandlerInterface and make our listeners also instances of ContainerAwareInterface.
Running Tests
Tests are available in a separated namespace and can run with PHPUnit in the command line:
Coding Standards
Phower code is written under PSR-2 coding style standard. To enforce that CodeSniffer tools are also provided and can run as:
Reporting Issues
In case you find issues with this code please open a ticket in Github Issues at https://github.com/phower/container/issues.
Contributors
Open Source is made of contribuition. If you want to contribute to Phower please follow these steps:
- Fork latest version into your own repository.
- Write your changes or additions and commit them.
- Follow PSR-2 coding style standard.
- Make sure you have unit tests with full coverage to your changes.
- Go to Github Pull Requests at https://github.com/phower/container/pulls and create a new request.
Thank you!
Changes and Versioning
All relevant changes on this code are logged in a separated log file.
Version numbers follow recommendations from Semantic Versioning.
License
Phower code is maintained under The MIT License.