Download the PHP package glebsky/simple-queue without Composer
On this page you can find all versions of the php package glebsky/simple-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download glebsky/simple-queue
More information about glebsky/simple-queue
Files in glebsky/simple-queue
Download glebsky/simple-queue
More information about glebsky/simple-queue
Files in glebsky/simple-queue
Vendor glebsky
Package simple-queue
Short Description Simple queues for your php application
License MIT
Package simple-queue
Short Description Simple queues for your php application
License MIT
Please rate this library. Is it a good library?
Informations about the package simple-queue
Simple Queue
Simple queues and simple queue handling for your PHP project
Russian
--- ## Installation The library is installed via composer. ## Configuration You need to implement the `TransportInterface` interface. You can use MySql, Redis or any other storage that suits you. The data that is present in `Message` and your class must be based on this data. > For example, you can refer to `example/DBTranspot.php` which works on PDO basis. > You can also use the ready-made `Transport` class `Glebsky\SimpleQueue\Transports\PDOTransport` which is based on PDO and works with SQL databases. > > To create a table of queues in the Database, the `migrate` method is present in this class ## Usage #### Create a task You need to create your own Job class to implement the interface `JobInterface` - `public $queueName` - property in this class You can assign a queue to a particular job. If this property is not added, the queue will not be assigned. - `public $priority` - property in this class You can set the priority in numbers, the higher the number, the higher the priority. `handle` method In this class will be executed when processing the queue. This is where you put the code you need. > An example class can be found in `example/TestJob.php` #### Adding a task to the queue The `Queue` class is used to add a task to the queue. We need to create an instance of our `TransportInterface` and connect it to the `Queue` class. Then we create our task - `TestJob` and add the task to the queue using the `dispatch` method #### Queue Processing The queue is processed using the `Worker` class. You can create your own PHP script where tasks will be handled, and you can run this script via CLI. An example of running a script. Where `example_queue,test_queue` are the comma-separated names of the queues to be processed. If you do not pass the queue name parameter, the handler will work with unnamed queues. It is also possible to process a specific task, in a place convenient for you in your application. ### Built-in PDOTransport class If you plan to set up communication based on SQL databases, you can use the built-in class `PDOTransport` Usage example: ### Tests To run tests, you can use the command `composer run-script test-simple-queues` > Examples can be found in the `example` folder Stand With UkraineAll versions of simple-queue with dependencies
PHP Build Version
Package Version
Requires
php Version
^7.0
ext-json Version *
ext-pdo Version *
ext-json Version *
ext-pdo Version *
The package glebsky/simple-queue contains the following files
Loading the files please wait ...