Download the PHP package bardoqi/php-hive-queue without Composer

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

Phive Queue

Build Status Scrutinizer Code Quality Code Coverage

Phive Queue is a time-based scheduling queue with multiple backend support.

Note: This package is forked from https://github.com/rybakit/phive-queue

Table of contents

Installation

The recommended way to install Phive Queue is through Composer:

Usage example

Queues

Currently, there are the following queues available:

MongoQueue

The MongoQueue requires the Mongo PECL extension (v1.3.0 or higher).

Tip: Before making use of the queue, it's highly recommended to create an index on a eta field:

Constructor

Parameters:

mongoClient The MongoClient instance
dbName The database name
collName The collection name

Example

RedisQueue

For the RedisQueue you have to install the Redis PECL extension (v2.2.3 or higher).

Constructor

Parameters:

redis The Redis instance

Example

TarantoolQueue

To use the TarantoolQueue you have to install the Tarantool PECL extension and a Lua script for managing queues.

Constructor

Parameters:

tarantool The Tarantool instance
tubeName The tube name
space Optional. The space number. Default to 0

Example

PheanstalkQueue

The PheanstalkQueue requires the Pheanstalk library (Beanstalk client) to be installed:

Constructor

Parameters:

pheanstalk The Pheanstalk\PheanstalkInterface instance
tubeName The tube name

Example

GenericPdoQueue

The GenericPdoQueue is intended for PDO drivers whose databases support stored procedures/functions (in fact all drivers except SQLite).

The GenericPdoQueue requires PDO and a PDO driver for a particular database be installed. On top of that PDO error mode must be set to throw exceptions (PDO::ERRMODE_EXCEPTION).

SQL files to create the table and the stored routine can be found in the res directory.

Constructor

Parameters:

pdo The PDO instance
tableName The table name
routineName Optional. The routine name. Default to tableName_pop

Example

SqlitePdoQueue

The SqlitePdoQueue requires PDO and SQLite PDO driver. On top of that PDO error mode must be set to throw exceptions (PDO::ERRMODE_EXCEPTION).

SQL file to create the table can be found in the res/sqlite directory.

Tip: For performance reasons it's highly recommended to activate WAL mode:

Constructor

Parameters:

pdo The PDO instance
tableName The table name

Example

SysVQueue

The SysVQueue requires PHP to be compiled with the option --enable-sysvmsg.

Constructor

Parameters:

key The message queue numeric ID
serialize Optional. Whether to serialize an item or not. Default to false
perms Optional. The queue permissions. Default to 0666

Example

InMemoryQueue

The InMemoryQueue can be useful in cases where the persistence is not needed. It exists only in RAM and therefore operates faster than other queues.

Constructor
Example

Item types

The following table details the various item types supported across queues.

Queue/Type string binary string null bool int float array object
MongoQueue
RedisQueue ✓* ✓*
TarantoolQueue
PheanstalkQueue
GenericPdoQueue
SqlitePdoQueue
SysVQueue ✓* ✓* ✓*
InMemoryQueue

✓* — supported if the serializer is enabled.

To bypass the limitation of unsupported types for the particular queue you could convert an item to a non-binary string before pushing it and then back after popping. The library ships with the TypeSafeQueue decorator which does that for you:

Exceptions

Every queue method declared in the Queue interface will throw an exception if a run-time error occurs at the time the method is called.

For example, in the code below, the push() call will fail with a MongoConnectionException exception in a case a remote server unreachable:

But sometimes you may want to catch exceptions coming from a queue regardless of the underlying driver. To do this just wrap your queue object with the ExceptionalQueue decorator:

And then, to catch queue level exceptions use the QueueException class:

Tests

Phive Queue uses PHPUnit for unit and integration testing. In order to run the tests, you'll first need to install the library dependencies using composer:

You can then run the tests:

You may also wish to specify your own default values of some tests (db names, passwords, queue sizes, etc.). You can do it by setting environment variables from the command line:

You may also create your own phpunit.xml file by copying the phpunit.xml.dist file and customize to your needs.

Performance

To check the performance of queues run:

This test inserts a number of items (1000 by default) into a queue, and then retrieves them back. It measures the average time for push and pop operations and outputs the resulting stats, e.g.:

You may also change the number of items involved in the test by changing the PHIVE_PERF_QUEUE_SIZE value in your phpunit.xml file or by setting the environment variable from the command line:

Concurrency

In order to check the concurrency you'll have to install the Gearman server and the German PECL extension. Once the server has been installed and started, create a number of processes (workers) by running:

Then run the tests:

This test inserts a number of items (100 by default) into a queue, and then each worker tries to retrieve them in parallel.

You may also change the number of items involved in the test by changing the PHIVE_CONCUR_QUEUE_SIZE value in your phpunit.xml file or by setting the environment variable from the command line:

License

Phive Queue is released under the MIT License. See the bundled LICENSE file for details.


All versions of php-hive-queue with dependencies

PHP Build Version
Package Version
Requires php Version ^5.4|^7.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 bardoqi/php-hive-queue contains the following files

Loading the files please wait ....