Download the PHP package earc/observer without Composer

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

eArc-observer

earc/observer is a ready to use and extendable psr-14 compatible observer blueprint.

Install

Bootstrap

earc/observer uses earc/di for dependency injection.

Place the above code in the section where your script/framework is bootstrapped.

Configure

earc/observer does not need any configuration.

Use

The event

Your event has to implement the EventInterface in order to be dispatchable by the dispatcher of earc/observer.

Extend the ListenerInterface if you want to be more specific.

Register Listeners

You can either use the observer object to register your listener

or use the tagging of earc/di (if the observer instance is not build yet)

Hint: Tagging does not initialize the observer nor does it autoload the observer class. Both does not autoload the listener until it is called upon to process the event.

Patience

If you pass a float as second or third argument respectively, it is interpreted as patience. The more patience the listener has the later it is called.

or (if the observer instance is not build yet)

Unregister Listeners

You can unregister by

or (if the observer instance is not build yet)

Note the different semantics of di_tag() and di_clear_tags().

Dispatch the event

To dispatch your event use the dispatcher

It returns the event that may be modified by the listener.

advanced usage

If you want to change the behaviour of the observer you can decorate it by any class implementing the ObserverInterface.

Please note that every library in your project, using earc/observer, uses the decorating class thereafter. Therefore you might be forced to write your own dispatcher too. All you need to do is implementing the DispatcherInterface.

releases

release 1.1

release 1.0.3

release 1.0.2

release 1.0.1

release 1.0

release 0.0


All versions of observer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
psr/event-dispatcher Version ^1.0
earc/di Version ^3.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 earc/observer contains the following files

Loading the files please wait ....