Download the PHP package fervo/deferred-event-bundle without Composer

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

FervoDeferredEventBundle

This bundle allows you to run asynchronous background processes in PHP. You don't need a PHP-daemon nor do you have to create a new php process for each job (which is expensive). We use PHP-FPM because it solves the performance and stability issues for us.

I wrote a blog entry with the reasoning behind this bundle, which you may want to read.

Caveat

This project is no longer actively developed by Fervo. We're still willing to merge PRs, but we're moving away from this internally. If you have a vested interest in this project and want to adopt it, contact us at [email protected].

Usage

You can defer events in two ways. You can decide when you dispatch an event that it should be deferred or you could let some listeners to decide if they should be deferred or not. In both cases we dispatch the event and put the job on a message queue.

As if by magic, at some later time, a worker will dispatch your event to your listeners. Pretty much the only caveats you'll need to keep in mind is that it is in another process, and that the code isn't executing in the request scope anymore.

Let the listeners decide

Just tag your listener with instead of , and the bundle will do the rest. Simple as pie.

Let the publisher decide

If you want all listeners to a event to be executed in a different thread you must wrap your Event in a DeferEvent. Then use the event dispatcher and dispatch 'fervo.defer'.

Setup

Server software

You need to install a message queue and a worker. The worker will pull jobs from the message queue and initiate the execution.

Currently we do support all message queues that support AMQP and Sidekiq.

Here is a list of workers:

Symfony setup

Add the bundle to your composer file, as well as well as your AppKernel. Configure the bundle as follows:

You do also need to setup one of the following (depending on you backend type):

Error handling

The Java worker we take care of errors. When a worker unexpectedly terminates we will save the message and the error message on a separate queue. You may subscribe to that queue to log the error and to retry executing the job.


All versions of deferred-event-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
symfony/event-dispatcher Version ~3.0
symfony/framework-bundle Version ~3.0
symfony/console 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 fervo/deferred-event-bundle contains the following files

Loading the files please wait ....