Download the PHP package fyre/queue without Composer
On this page you can find all versions of the php package fyre/queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package queue
FyreQueue
FyreQueue is a free, open-source queue library for PHP.
Table Of Contents
- Installation
- Methods
- Queues
- Redis
- Workers
- Listeners
- Messages
Installation
Using Composer
In PHP:
Methods
Clear
Clear all instances and configs.
Get Config
Set a Queue config.
$key
is a string representing the Queue key.
Alternatively, if the $key
argument is omitted an array containing all configurations will be returned.
Get Key
Get the key for a Queue instance.
$queue
is a Queue.
Has Config
Check if a Queue config exists.
$key
is a string representing the Queue key, and will default toQueueManager::DEFAULT
.
Is Loaded
Check if a Queue instance is loaded.
$key
is a string representing the Queue key, and will default toQueueManager::DEFAULT
.
Load
Load a Queue.
$options
is an array containing configuration options.
Push
Push a job to a Queue.
$className
is a string representing the job class.$arguments
is an array containing arguments that will be passed to the job.$options
is an array containing options for the Message.config
is a string representing the configuration key, and will default to "default".queue
is a string representing the Queue name, and will default to "default".method
is a string representing the class method, and will default to "run".delay
is a number representing the number of seconds before the job should run, and will default to 0.expires
is a number representing the number of seconds after which the job will expire, and will default to 0.
Set Config
Set the Queue config.
$key
is a string representing the Queue key.$options
is an array containing configuration options.
Alternatively, a single array can be provided containing key/value of configuration options.
Unload
Unload a Queue.
$key
is a string representing the Queue key, and will default toQueueManager::DEFAULT
.
Use
Load a shared Queue instance.
$key
is a string representing the Queue key, and will default to "default".
Queues
You can load a specific queue by specifying the className
option of the $options
variable above.
Custom queues can be created by extending \Fyre\Queue\Queue
, ensuring all below methods are implemented.
Clear
Clear all items from the queue.
$queueName
is a string representing the queue name.
Get Listener
Get the queue Listener.
Pop
Pop the last item off the queue.
$queueName
is a string representing the queue name.
Push
Push an item onto the queue.
$queueName
is a string representing the queue name.$message
is a Message.
Redis
The Redis queue can be loaded using custom configuration.
$key
is a string representing the queue key.$options
is an array containing configuration options.className
must be set to\Fyre\Queue\Handlers\RedisQueue
.listener
is a string representing the Listener class, and will default to\Fyre\Queue\Listener
.host
is a string representing the Redis host, and will default to "127.0.0.1".password
is a string representing the Redis passwordport
is a number indicating the Redis port, and will default to 6379.database
is a string representing the Redis database.timeout
is a number indicating the connection timeout.
Workers
Workers are long running tasks that will consume and execute jobs from the queue.
$options
is an array containing configuration options.config
is a string representing the configuration key, and will default to "default".queue
is a string representing the queue name, and will default to "default".maxJobs
is a number representing the maximum number of jobs to execute, and will default to 0.maxRuntime
is a number representing the maximum number of seconds the worker should run, and will default to 0.
Run
Run the worker.
Listeners
You can use a specific listener by specifying the listener
option of the $options
variable above.
Custom listener can be created by extending \Fyre\Queue\Listener
, ensuring all below methods are implemented.
Exception
Handle a message exception.
$message
is the Message.$exception
is the exception.
Failure
Handle a failed message.
$message
is the Message.
Invalid
Handle an invalid message.
$message
is the Message.
Start
Handle a start message.
$message
is the Message.
Success
Handle a success message.
$message
is the Message.
Messages
Messages are used internally to pass data between the Listener.
$options
is an array containing options for the message.className
is a string representing the job class.arguments
is an array containing arguments that will be passed to the job.config
is a string representing the configuration key, and will default to "default".queue
is a string representing the queue name, and will default to "default".method
is a string representing the class method, and will default to "run".delay
is a number representing the number of seconds before the job should run, and will default to 0.expires
is a number representing the number of seconds after which the job will expire, and will default to 0.
Get Arguments
Get the message arguments.
Get Callback
Get the message callback.
Get Config
Get the message config.
Get Hash
Get the message hash.
Is Expired
Determine if the message has expired.
Is Ready
Determine if the message is ready.
Is Unique
Determine if the message is unique.
Is Valid
Determine if the message is valid.