Download the PHP package studio24/pubsub without Composer
On this page you can find all versions of the php package studio24/pubsub. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download studio24/pubsub
More information about studio24/pubsub
Files in studio24/pubsub
Download studio24/pubsub
More information about studio24/pubsub
Files in studio24/pubsub
Vendor studio24
Package pubsub
Short Description Simple implementation of the PubSub design pattern in PHP
License MIT
Homepage https://github.com/studio24/pubsub
Package pubsub
Short Description Simple implementation of the PubSub design pattern in PHP
License MIT
Homepage https://github.com/studio24/pubsub
Please rate this library. Is it a good library?
Informations about the package pubsub
PubSub
Simple implementation of the PubSub design pattern in PHP.
Installation
Usage
Import at the top of your PHP script via:
Add a task to run at a certain event (subscribe)
This will run the passed anonymous function when the event 'myevent' is run.
PubSub::subscribe($event, $callback, $weight)
Params:
- $event (string) Event name
- $callback (callback) Callback function to run
- $weight (int) Optional, weight to define the order subscribed tasks run, defaults to 10. The lower the number the earlier this callback runs
Run tasks at a certain event (publish)
This runs all tasks which are subscribed to the 'myevent' event, passing the argument $name.
PubSub::publish($event, ...$arguments)
Params:
- $event (string) Event name
- $arguments (mixed) Optional, one or many arguments to pass to the callback function
License
The MIT License (MIT). Please see License File for more information.
Credits
All versions of pubsub with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.6.0
The package studio24/pubsub contains the following files
Loading the files please wait ....