PHP Classes

QPHP: Exchange messages with a queue server using Swoole

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 58 All time: 10,551 This week: 53Up
Version License PHP version Categories
qphp 1.0MIT/X Consortium ...8Networking, PHP 8
Description 

Author

This package implements an application exchange messages with a queue server using Swoole.

It implements a server that listens to TCP connection requests and can receive messages from clients and store them in a queue table managed by Swoole.

The application also allows clients to pull queued messages from the queue table.

Innovation Award
PHP Programming Innovation award nominee
December 2021
Number 7
Swoole is a framework for developing PHP applications that can run multiple parallel tasks using asynchronous programming to make the studies faster.

This package implements an application to exchange messages using queues. It uses Swoole to make it possible to exchange multiple notes simultaneously between clients and servers.

This way, the message exchange is faster than traditional solutions that do not use asynchronous programming.

Manuel Lemos
Picture of LAGGOUNE Walid
  Performance   Level  
Innovation award
Innovation award
Nominee: 3x

 

Example

<?php

require "vendor/autoload.php";
use
App\Booter;
use
App\Server\Server;

$server = new Server((new Booter)->loadConfigurations(__DIR__));
$server->start();


Details

QPHP

QPHP is a simple, fast work queue server extendable to LUA scripts. Built using PHP & SWOOLE.

RUN it

First, build the image :

docker-compose build

Run :

docker-compose up
docker-compose exec php-queue bash
cd queue-worker
php server.php

Running port is : 15674

Config

src/config/.env <br/> - MAX_CONN : https://www.swoole.co.uk/docs/modules/swoole-server/configuration#max_conn - QUEUE_TABEL_SIZE: This table is responsible to store queues payloads. https://www.swoole.co.uk/docs/modules/swoole-table-construct - IGNORE_NO_LISTENERS: 0 or 1 , if 0 the server will not dispatch the queues if there is no >= 1 listener. - BUFFER_OUTPUT_SIZE: https://www.swoole.co.uk/docs/modules/swoole-server/configuration#buffer_output_size - REACTOR_NUM: https://www.swoole.co.uk/docs/modules/swoole-server/configuration#reactor_num - WORKER_NUM: https://www.swoole.co.uk/docs/modules/swoole-server/configuration#worker_num

How to use it / examples

See the examples/ folder

Observers

PHP observer

app/Parser/Observer/ParserObserver.php You can write PHP code to handle received queues and parse them before saving them to the storage. Also, you can handle the queue message before sending them to listeners.

Extend to Lua

You can write LUA code to handle received queues and parse them before saving them to the storage. Also, you can handle the queue message before sending them to listeners.


  Files folder image Files (1538)  
File Role Description
Files folder imagephp (1 file)
Files folder imagesrc (3 files, 6 directories)
Accessible without login Plain text file docker-compose.yml Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:58
This week:0
All time:10,551
This week:53Up