Download the PHP package gplanchat/php-event-manager without Composer

On this page you can find all versions of the php package gplanchat/php-event-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-event-manager

php-event-manager

PHP events management library.

Description

The event emitting manager let you implement callback-based event management, for implementing modular code or to make easier class reuse.

Event-based programming is currently available natively into multiple languages and brings some new ways of writing code. Having in mind that this pattern should be used to make code easier to maintain, this pattern should not be used in all cases, especially where other patterns are simpler to implement.

Requirements

Unit testing

Run the following command to launch PHPUnit unit tests under the package root directory :

$ phpunit --strict --configuration build/phpunit.xml

Examples

You may find the following code examples useful. Some more examples could be found in the unit tests suite in the tests/ folder.

Basic usage with SharedEventEmitter

$eventEmitter = new SharedEventEmitter();

// Registering a callback for the event 'ready'
$eventEmitter->on(['ready'], function(Event $e) {
    // Your event code comes here...
});

// ...

// Calling the event
$eventEmitter->emit(new Event('ready'));

Passing datas into the Event

$eventEmitter = new SharedEventEmitter();

// Registering a callback for the event 'ready'
$eventEmitter->on(['ready'], function(Event $e) {
    // Your event code comes here...
});

// ...

// Calling the event
$eventEmitter->emit(new Event('ready', [
    'my_object' => new stdClass
]));

Passing datas into the Event, with a defined priority for the callback

$priority = 100;
$callback = function(Event $e) {
    // Your event code comes here...
};

$eventEmitter = new SharedEventEmitter();

// Registering a callback for the event 'ready'
$eventEmitter->on(['ready'], $callback, $priority);

// ...

// Calling the event
$eventEmitter->emit(new Event('ready', [
    'my_object' => new stdClass
]));

Passing datas during event emitting

$eventEmitter = new SharedEventEmitter();

// Registering a callback for the event 'ready'
$eventEmitter->on(['ready'], function(Event $e, $isError, $object) {
    // Your event code comes here...
});

// ...

// Calling the event,
$eventEmitter->emit(new Event('ready'), false, new stdClass);

Implement the EventEmitterInterface interface to build your own event emitters

You may implement this event emitter manager for adding event management to existing frameworks.

class Application
    extends Foo\Framework\ApplicationAbstract
    implements EventEmitterInterface
{
    use EventEmitterTrait;

    public function bootstrap()
    {
        // Bootstrap the instance...

        // emit the 'bootstrap' event, when your method has finished the basic bootstrapping
        $this->emit(new Event('bootstrap', ['application' => $this]));

        return $this;
    }
}

//...

// Registering a callback for the event 'bootstrap'
$eventEmitter->on(['bootstrap'], function(Event $e) {
    // Your event code comes here...
});

//...

// Your caller code looks like this :
$app = new Application();
$app->bootstrap();

All versions of php-event-manager with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gplanchat/php-event-manager contains the following files

Loading the files please wait ....