Recommend this page to a friend! |
Download .zip |
Info | View files (7) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2007-12-31 (8 years ago) | Not enough user ratings | Total: 911 | All time: 3,749 This week: 988 |
Version | License | PHP version | Categories | |||
eventphp5 0.1.0 | Free To Use But R... | 5.1 | PHP 5, Language |
Description | Author | |||||||||||||
This package can be used to register event handlers and trigger the execution of actions when an event occurs. |
|
This class is an Event simulation that resembles some other languages' functionalities, such as .NET events. The idea is that user creates an Event put in the static array in the class, accessible only via the static methods. The Event object itself is never accessible. However, there is an EventWrapper, which wraps functionality in way shown in the example.php file. To create an Event first you need to provide i.Event_Name.Event interface which has the on.Event_Name.Call and on.Event_name.Destroy functions (see documentation of Event.php). You can also provide other interface name, but the interface has to define these methods. Events are either Private, Protected or Public. Private events can be called only by the instance of EventCaller (or one of it's descendants) provided during Event creation. Making this caller private member of class makes event callable only by that class. Protected Events are callable only via the instance of a class, which name is provided during the creation. Since there is no possibility to create internal classes, object can be created to call the event. Hovewer, informational purposes require making it this way. When getting the CallerClass classname one can easily determine which module/library is the "owner" of the Event. Public events can be raised by any object which is EventCaller or one of it's descendants. Events provide datasets. Dataset is an information set which is an argument for Listeners. Listener is an object which "listens" whether the Event was raised. On raising the event, the on.Event_Name.Call is called. The callback function with one argument - dataset. Listeners have to implement the Event's interface provided at creation. Dataset can be of a null value, nevertheless handler methods must have at least one argument. Events are disposable or non-disposable. Disposable Events are unset after raising. Non-disposable stay in the memory (private events can be destroyed by unsetting the caller instance and calling the Event::callerDestroyed() function). First event is created either by the static Event::init() method or on first event creation. It's the EventCreated Event, non-disposable, with EventInfo dataset. EventCreated is raised when new event is created, as it's name says :). More documentation in the .php files. License: this package is available for non-commercial usage, after notyfying the author (szpakowski@gmail.com), on GPL License. Using this package in commercial projects has to be agreed by the author (usually free). Author does not provide any guarantees for the class. Have fun. |
Files |
File | Role | Description |
---|---|---|
ACE_Exception.php | Class | Exception class |
Event.php | Class | Base class |
EventCaller.php | Class | Event Caller class |
EventInfo.php | Class | Event Info for the EventCreated Event |
EventWrapper.php | Class | Wrapper class for elegant usage |
example.php | Example | Example usage |
README.txt | Doc. | README and Licence |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.