Download the PHP package joomla-x/event without Composer

On this page you can find all versions of the php package joomla-x/event. 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 event

The Event Package Build Status

The event package provides foundations to build event systems and an implementation supporting prioritized listeners.

Events

Example

An event has a name and can transport arguments.

Its propagation can be stopped

Event Listeners

An event listener can listen to one or more Events.

You can create two types of listeners : using a class or a closure (anonymous function).

The functions MUST take an EventInterface (or children) as unique parameter.

Classes

The listener listens to events having names matching its method names.

Closures

Closures can listen to any Event, it must be declared when adding them to the Dispatcher (see below).

The Dispatcher

The Dispatcher is the central point of the Event system, it manages the registration of Events, listeners and the triggering of Events.

Registering Object Listeners

Following the example above, you can register the ContentListener to the dispatcher :

If the object contains other methods that should not be registered, you will need to explicitly list the events to be registered. For example:

Registering Closure Listeners

As you noticed, it is possible to specify a listener's priority for a given Event. It is also possible to do so with "object" Listeners.

Filtering Listeners

DEPRECATED

Listeners class can become quite complex, and may support public methods other than those required for event handling. The setListenerFilter method can be used to set a regular expression that is used to check the method names of objects being added as listeners.

Registration with Priority

The default priority is the Priority::NORMAL.

When you add an "object" Listener without specifying the event names, it is registered with a NORMAL priority to all events.

If some listeners have the same priority for a given event, they will be called in the order they were added to the Dispatcher.

Registering Events

You can register Events to the Dispatcher, if you need custom ones.

By default, an Event object is created with no arguments, when triggering the Event.

Triggering Events

Once you registered your listeners (and eventually events to the Dispatcher), you can trigger the events.

The listeners will be called in a queue according to their priority for that Event.

If you registered an Event object having the onAfterSomething name, then it will be passed to all listeners instead of the default one.

You can also pass a custom Event when triggering it

If you already added an Event with the onAfterSomething name using addEvent, then the event passed to the triggerEvent method will be chosen instead.

Stopping the Propagation

As said above, you can stop the Event propagation if you are listening to an Event supporting it, it is the case for the Event class.

When stopping the Event propagation, the next listeners in the queue won't be called.

Observable classes

Observable classes depend on a Dispatcher, and they may implement the DispatcherAwareInterface interface.

Example of a Model class :

Immutable Events

An immutable event cannot be modified after its instantiation:

It is useful when you don't want the listeners to manipulate it (they can only inspect it).

The Delegating Dispatcher

A dispatcher that delegates its method to an other Dispatcher. It is an easy way to achieve immutability for a Dispatcher.

This is useful when you want to make sure that 3rd party applications, won't register or remove listeners from the Dispatcher.

Installation via Composer

Add "joomla-x/event": "3.0.*@dev" to the require block in your composer.json and then run composer install.

Alternatively, you can simply run the following from the command line:


All versions of event with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.10|>=7.0
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 joomla-x/event contains the following files

Loading the files please wait ....