Download the PHP package samsonos/php_event without Composer

On this page you can find all versions of the php package samsonos/php_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 php_event

SamsonPHP events module

We have build unique and very simple approach to make our modules and classes very loosely coupled by creating event-driven logic. All core module code is build using this approach which gives unlimited abilities in extending its functionality and adding supeior features to it. This approach is build with programming pattern Observer in mind, but has a little bit different approach.

Events gives us opportunity to remove interclass connections, so it would be perfectly suited for writing unit tests. From other hand, before moving to event based system, we had a lot of different handler stack, every of them fulfilled only only specific goal and had to have field and function for working with it, with event approach we dont need all this stacks, functions and other stuff anymore.

Latest Stable Version Build Status Coverage Status Code Climate Total Downloads Scrutinizer Code Quality

Basics

We have created one simple static class to provide all this awesome features in SamsonPHP, called . This class has two main simple static functions:

Event identifier

This is the main parameter which connects event subscribers and executors, identifier must match followings standard rules:

Event - Subscribe

This method is used to register listener for a specific event identifier, there is no actual validation or checking if this identifier will ever be fired somewhere, we actually do not know, but we hope, and our hopes would be fulfilled, as we can read module documentation and subscribe only for existing events. This is done so because we cannot guarantee what events will actually fire because code can be loaded in different order(thanks to autoloading) and sucbcribe() can be called much earlier then event declaration possibly be, so we have decided and putted this responsibility on developers shoulders and only they must think of what event they subscribe on.

Method declaration:

Every call to event subscription will return unique handler identifier for this unique event identifier, this identifier can be used to unsubscribe from event.

Event - Unsubscribe

If want to remove your event subscription for some reason you need to use event identifier and handler identifier: Method declaration:

Event - Fire

This method is used to tell all other listeners(modules, classes) who has subscribed to current event identifier that its being happened right here and right now. When this method is triggered its meant that this is exact place and time when all subscribers must handle current event.

Method declaration:

We recommend to think twice before firing event somewhere in your code, as this must be realy needed and usefull event to avoid system overhead.

When the actual event is trigered, system merges event fired params with subscribe parameters, event fired parameters is first to be passed to callback function. This is done in this way because there can be any amount of subscribers with different count of parameters, but the event firing parameters will never change.

Event - Signal

This is method is used to perform only LAST subscriber callback will be called and the result of it execution will be returned. This is done when this event must be handled only once. Method declaration:

All other logic is the same as Event - Fire

For example events for routing system, you cannot use multiple routing systems in one application.

Changing data in subscribed event handlers

When you want to pass variable to event handler to change it just use array with references syntax:

In the example described above we have passed a $url variable by reference to all possible subscribers to event, and if one of them will change it, it will be changed every where.


All versions of php_event with dependencies

PHP Build Version
Package Version
No informations.
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 samsonos/php_event contains the following files

Loading the files please wait ....