Download the PHP package jmikola/wildcard-event-dispatcher without Composer

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

WildcardEventDispatcher

Build Status

This library implements an event dispatcher, based on Symfony's interface, with wildcard syntax inspired by AMQP topic exchanges. Listeners may be bound to a wildcard pattern and be notified if a dispatched event's name matches that pattern. Literal event name matching is still supported.

Note: the wildcard syntax used by this library is not compatible with the simpler event dispatching introduced in Symfony 4.3, which uses the FQCN of the event in lieu of a custom string (e.g. core.request).

If you are interested in using this library in a Symfony project, you may also want to take a look at the corresponding bundle.

Installation

The library is published as a package and is installable via Composer:

Compatibility

This library requires Symfony 4.3 or above.

Usage

WildcardEventDispatcher implements EventDispatcherInterface and may be used as you would Symfony's standard EventDispatcher:

Internally, WildcardEventDispatcher actually composes an EventDispatcherInterface instance, which it relies upon for event handling. By default, WildcardEventDispatcher will construct an EventDispatcher object for internal use, but you may specify a particular EventDispatcherInterface instance to wrap in the constructor:

Wildcard Syntax

Single-word Wildcard

Consider the scenario where the same listener is defined for multiple events, all of which share a common prefix:

These event names all consist of two dot-separated words. This concept of a word will be important in understanding how wildcard patterns apply.

In this example, the listener is responsible for observing all core events in the application. Let's suppose it needs to log some details about these events to an external server. We can refactor multiple addListener() calls by using the single-word * wildcard:

The listener will now observe all events named core or starting with core. and followed by another word. The matching of core alone may not make sense, but this is implemented in order to be consistent with AMQP. A trailing * after a non-empty sequence may match the preceding sequence sans .*.

Multi-word Wildcard

Suppose there was a core event in your application named core.foo.bar. The aforementioned core.* pattern would not catch this event. You could use:

This syntax would match core.foo and core.foo.bar, but core would no longer be matched (assuming there was such an event).

The multi-word # wildcard might be more appropriate here:

Suppose there was also an listener in the application that needed to listen on all events in the application. The multi-word # wildcard could be used:

Additional Wildcard Documentation

When in doubt, the unit tests for ListenerPattern are a good resource for inferring how wildcards will be interpreted. This library aims to mimic the behavior of AMQP topic wildcards completely, but there may be shortcomings.

Documentation for actual AMQP syntax may be found in the following packages:


All versions of wildcard-event-dispatcher with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
symfony/event-dispatcher Version ^4.3 || ^5.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 jmikola/wildcard-event-dispatcher contains the following files

Loading the files please wait ....