Blaze

PHP
NodeJS

Asynchronous background task queue manager for PHP. Uses NodeJS as a listener for queues, while PHP is executing the tasks from workers

Blaze

Welcome to the private Blaze composer package

Requirements

  1. PHP 7.2 or newer
  2. Redis 3.0+
  3. MySQL 8.0+

Installation

Blaze is made up from 2 main parts:

  1. Master - nodejs library that controls the distribution of tasks. Only one master should run at the same time.
  2. Worker - for execution of tasks in PHP enviroments.

Installing the PHP Client (Worker)

To install with composer, please add these lines to your composer.json file:

"repositories": [{
  "type": "composer",
  "url": "https://ams.repo.repman.io"
}]

Then, run composer require ams/blaze

To implement correctly, make sure you've followed these steps:

  1. Use a supervisor for the execution of bin/worker.php. You can run multiple workers on the same server.
  2. Configure .env file in the root of your project.

To run tasks, please provide the psr-4 namespace of your tasks folder inside your composer.json:

"autoload": {
  "psr-4": {
   "Tasks\\" : "tasks"
  }
}

Example for supervisor config to automatically consume worker

[program:blaze-worker]
command=php /var/www/grindr/bin/worker.php      
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/var/log/apache2/blaze-worker.log
startsecs=0
process_name=%(program_name)s_%(process_num)s
numprocs=3

Usage

coming soon