Download the PHP package kelvinmo/f3-event-dispatcher without Composer

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

Event Dispatcher for the Fat-Free Framework

This is a simple PSR-14 compliant event dispatcher and listener provider library for the Fat-Free Framework.

Latest Stable Version build

Requirements

Installation

You can install via Composer.

Usage

Listener Provider

The listener provider is implemented by the \Listeners class. Listeners is a subclass of Fat-Free's \Prefab class.

To add a listener, call the on() method. The name of the event is specified in the first parameter and the listener in the second parameter.

As required by PSR-14, if the name of the event is the name of a class, then the listener will also be triggered for all subclasses of that event class.

The listener can be a PHP callable, or a string that can be resolved by Fat-Free's call() method

The on() method also takes a third, optional parameter, specifying the priority which the listeners should be called. Listeners are called from the highest priority to the lowest.

You can use Listeners with any PSR-14-compliant event dispatcher.

Generic Events

Sometimes it is too cumbersome to create a new event class for every single event. You can use generic events to group a set of related events into a single class.

A generic event implements GenericEventInterface and provides the name of the event through the getEventName() method.

Adding Listeners via Reflection

You can also add listeners using reflection by the map() method. This method takes a name or an instantiated object of a class. A listener will be added based on a method of this class if:

  1. It is a public method (whether or not it is also static)
  2. The name of the method starts with on
  3. The method takes exactly one parameter, and the parameter is type-hinted with an event class.

The name of the event the method will listen to depends on the name of the method. If the name of the method is the same as the short name of the type hint of the parameter, then the name of the event is the fully qualified name of the parameter type. Otherwise, the name of the event is the method name converted to snake case, in which case the event type must be a generic event (i.e. implements GenericEventInterface).

Event Dispatcher

The event dispatcher is implemented by the \Events class. Events is a subclass of Fat-Free's \Prefab class.

By default, Events uses the Listeners listener provider included in this library. To use a different listener provider, pass the provider as an argument in the constructor.

To use the event dispatcher, call the standard PSR-14 dispatch() method:

Licence

GPL 3 or later


All versions of f3-event-dispatcher with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
psr/event-dispatcher Version ^1.0
bcosca/fatfree-core Version ^3.5
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 kelvinmo/f3-event-dispatcher contains the following files

Loading the files please wait ....