What are some recommended tools or libraries for implementing message queues in PHP for batch processing tasks?

When dealing with batch processing tasks in PHP, using message queues can help in distributing the workload and ensuring that tasks are processed efficiently and reliably. Some recommended tools or libraries for implementing message queues in PHP include RabbitMQ, Beanstalkd, and Redis.

// Example using RabbitMQ
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();

$channel->queue_declare('task_queue', false, true, false, false);

$data = 'Your task data here';

$msg = new AMQPMessage($data, ['delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT]);

$channel->basic_publish($msg, '', 'task_queue');

$channel->close();
$connection->close();