beauty-framework/parallels 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

beauty-framework/parallels

最新稳定版本:1.0.0

Composer 安装命令:

composer require beauty-framework/parallels

包简介

Beauty Parallels (RoadRunner, Fibers)

README 文档

README

A lightweight concurrency manager for PHP, supporting Fiber-based parallel execution out of the box. Optionally, you can use RoadRunner jobs-based parallelism (WIP).

Installation

composer require beauty-framework/parallels

Quick Start

use Beauty\Parallels\Concurrent;
use Beauty\Parallels\WorkersName;

$results = Concurrent::run([
    'task-1' => fn() => 1 + 1,
    'task-2' => fn() => strtoupper('hello'),
]);

print_r($results);

Output:

[
    'task-1' => 2,
    'task-2' => 'HELLO',
]

Execution Modes

Concurrent::run(array $callbacks, int $timeoutSeconds = 10, string $type = WorkersName::FIBER): array

Available modes:

Mode Description
fiber Default. Uses PHP Fibers (cooperative multitasking)
process WIP. Spawns tasks via RoadRunner Jobs pipeline

You can explicitly choose the execution strategy:

Concurrent::run([
    'a' => fn() => 42,
], 5, WorkersName::FIBER);

Notes

  • Fiber-based mode is enabled by default, lightweight and fast.
  • RoadRunner-based process execution is under active development and is experimental.

TODO

  • Finish implementation of ProcessConcurrencyWorker based on spiral/roadrunner-jobs
  • Add serialization-safe closures via opis/closure
  • Result collector with Redis or temp files
  • Per-task exception handling and cancellation support
  • Tests

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-10