Download the PHP package javibravo/simple-php-queue without Composer

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

Simpleue - Simple Queue Worker for PHP

Build Status Total Downloads Latest Stable Version

Simpleue provide a very simple way to run workers to consume queues (consumers) in PHP. The library have been developed to be easily extended to work with different queue servers and open to manage any kind of job.

Current implementations:

You can find an example of use in simpleue-example

Worker

The lib has a worker class that run and infinite loop (can be stopped with some conditions) and manage all the stages to process jobs:

The loop can be stopped under control using the following methods:

Each worker has one queue source and manage one type of jobs. Many workers can be working concurrently using the same queue source.

Graceful Exit

The worker is also capable for handling some posix signals, viz. SIGINT and SIGTERM so that it exits gracefully (waits for the current queue job to complete) when someone tries to manually stop it (usually with a C-c keystroke in a shell).

This behaviour is disabled by default. To enable it, you need to pass an extra parameter in the constructor of the worker class. See Usage below for an example.

Note: This feature is not tested in HHVM, thus might not work as expected if you are running it on HHVM

Queue

The lib provide an interface which allow to implement a queue connection for different queue servers. Currently the lib provide following implementations:

The queue interface manage all related with the queue system and abstract the job about that.

It require the queue system client:

And was well the source queue name. The consumer will need additional queues to manage the process:

Important

For AWS SQS Queue all the queues must exist before start working.

Jobs

The job interface is used to manage the job received in the queue. It must manage the domain business logic and define the STOP job.

The job is abstracted form the queue system, so the same job definition is able to work with different queues interfaces. The job always receive the message body from the queue.

If you have different job types ( send mail, crop images, etc. ) and you use one queue, you can define isMyJob. If job is not expected type, you can send back job to queue.

Install

Require the package in your composer json file:

Usage

The first step is to define and implement the Job to be managed.

Once the job is defined we can define our consumer and start running:

Redis Consumer

AWS SQS Consumer

Beanstalkd Consumer

Using maxIterations

There are two ways you can set maximum iterations, both are shown below:

Using Setter Method

Using Constructor Parameter

Enabling Graceful Exit

To enable graceful exit, pass in an extra parameter in the constructor.

AWS SQS Job Locking to Prevent Duplication

When using AWS SQS Standart Queue, sometimes workers can get duplicated messages even if MessageVisibilityTimeout given. To prevent this duplication, you can give Redis or Memcached Locker to SqsQueue object. If you proived locker object and lock failed, job sent to error queue. Locker provider does not remove/unlock job. If required, you should unlock manually. You can get job key with getJobUniqId method.

See http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/standard-queues.html#standard-queues-at-least-once-delivery for more info

(*) The idea is to support any queue system, so it is open for that. Contributions are welcome.


All versions of simple-php-queue with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
psr/log Version ~1.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 javibravo/simple-php-queue contains the following files

Loading the files please wait ....