Download the PHP package tarantool/queue without Composer

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

Tarantool Queue

Quality Assurance Scrutinizer Code Quality Code Coverage Mentioned in Awesome PHP Telegram

Tarantool is a NoSQL database running in a Lua application server. It integrates Lua modules, called LuaRocks. This package provides PHP bindings for Tarantool Queue LuaRock.

Table of contents

Installation

The recommended way to install the library is through Composer:

Before start

In order to use queue, you first need to make sure that your Tarantool instance is configured, up and running. The minimal required configuration might look like this:

You can read more about the box configuration in the official Tarantool documentation. More information on queue configuration can be found here.

To start the instance you need to copy (or symlink) queues.lua file into the /etc/tarantool/instances.enabled directory and run the following command:

Working with queue

Once you have your instance running, you can start by creating a queue object with the queue (tube) name you defined in the Lua script:

where $client is an instance of Tarantool\Client\Client from the tarantool/client package.

Data types

Under the hood Tarantool uses MessagePack binary format to serialize/deserialize data being stored in a queue. It can handle most of the PHP data types (except resources and closures) without any manual pre- or post-processing:

To learn more about object serialization, please follow this link.

Tasks

Most of the Task object containing the following getters:

And some sugar methods:

Producer API

As you've already seen, to insert a task into a queue you need to call put() method, which accepts two arguments: the data you want to process and optional array of task options, which this particular queue supports. For example, fifottl queue (which we defined earlier in our Lua config file), supports delay, ttl, ttr and pri options:

See the full list of available options here.

Consumer API

To reserve a task for execution, call take() method. It accepts an optional timeout parameter. If a timeout value is supplied the call will wait timeout seconds until a READY task appears in the queue. The method returns either a Task object or null:

After successful execution, a task can be marked as acknowledged (that will also delete the task from a queue):

Or put back into the queue in case it cannot be executed:

To look at a task without changing its state, use:

To bury (disable) a task:

To reset buried task(s) back to READY state:

To increase TTR and/or TTL of a running task (only for *ttl queues):

A task (in any state) can be deleted permanently with delete():

To delete all tasks in a queue:

For a detailed API documentation, please read the section "Using the queue module" of the queue README.

Statistics

The stats() method provides access to the statistical information accumulated since a queue was created:

The result of this call might look like this:

In addition, you can specify a key to return only a subset of the array:

Custom methods

Thanks to flexible nature of the queue Lua module, you can easily create your own queue drivers or extend existing ones with an additional functionality. For example, suppose you added the put_many method to your foobar queue, which inserts multiple tasks atomically:

To invoke this method from php, use Queue::call():

Testing

The easiest way to run tests is with Docker. First, build an image using the dockerfile.sh generator:

Then run a Tarantool instance (needed for integration tests):

And then run both unit and integration tests:

The library uses PHPUnit under the hood, and if needed, you can pass additional arguments and options to the phpunit command. For example, to run only unit tests, execute:

License

The library is released under the MIT License. See the bundled LICENSE file for details.


All versions of queue with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2.5|^8
tarantool/client Version ^0.10
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 tarantool/queue contains the following files

Loading the files please wait ....