定制 olbie/miniq 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

olbie/miniq

最新稳定版本:0.2.1

Composer 安装命令:

composer require olbie/miniq

包简介

Mini Queue

README 文档

README

MiniQ is a minimalist PHP library designed for queue management, utilizing sockets for inter-process communication. It offers a simple way to manage task queues and process them with workers. MiniQ is built on ReactPHP components, making it suitable for asynchronous PHP applications.

Features

  • Simple and lightweight queue management.
  • Uses Unix sockets for communication.
  • Easily integrates with the ReactPHP event loop.
  • Supports asynchronous task handling.

Translate

Installation

You can install MiniQ using Composer. Run the following command in your project directory:

composer require olbie/miniq

Requirements

  • PHP 8.1 or newer
  • Composer for dependency management

Usage

Server Setup

Create a server to manage your tasks:

<?php

require_once __DIR__ . '/vendor/autoload.php';

use olbie\MiniQ\MiniQ;

$miniQ = new MiniQ(__DIR__);
$server = $miniQ->createServer();
$server->start();

Worker Setup

Set up a worker to process tasks:

<?php

use olbie\MiniQ\MiniQ;
use React\EventLoop\Loop;

require_once __DIR__ . '/vendor/autoload.php';

$miniQ = new MiniQ(__DIR__);
$worker = $miniQ->createWorkerServer();
$worker->run();

Client Usage

Add tasks to the queue using a client:

<?php

use olbie\MiniQ\MiniQ;
use olbie\MiniQ\Job;

require_once __DIR__ . '/vendor/autoload.php';

$totalTask = 25;
$miniQ = new MiniQ(__DIR__);
$client = the miniQ->createClient();

for ($i = 0; $i < $totalTask; $i++) {
    $client->set(new Job(rand(1, 10)));
}

TO DO

  • write test
  • write license file
  • translate docs
    • Ukraine
    • Russian
  • make symfony bandle

License

GPL-3.0-or-later. See the LICENSE file for more details.

Contributing

Contributions are welcome!

Contact

For questions or feedback, please contact Oleksii Bielokudrenko at oleksii.bielokudrenko@gmail.com.

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2024-04-26