pardnchiu/async
最新稳定版本:1.0.0
Composer 安装命令:
composer require pardnchiu/async
包简介
PD\Async is a PHP library using ReactPHP to perform asynchronous tasks, supporting task dependency handling and topological sorting.
README 文档
README
PD\Async is a PHP library using ReactPHP to perform asynchronous tasks, supporting task dependency handling and topological sorting.
Features
- Asynchronous Task Execution
- Handling of Task Dependencies
- Ensuring correct execution order via Topological Sorting
Key Capabilities
- Non-blocking Task Processing
- Task Dependency Management
- Smart Execution Ordering
- Promise Error Handling
- Flexible Task Configuration
Dependencies
react/promise- Promise/A+ for PHPreact/event-loop- Event Loop Library for PHP
How to Use
Install
composer require pardnchiu/async
<?php use PD\Async; $tasks = [ 'task1' => [ 'method' => function () { return 'result1'; }, 'tasks' => [], ], 'task2' => [ 'method' => function () { return 'result2'; }, 'tasks' => ['task1'], // Run after task1 ], 'task3' => [ 'method' => function () { return 'result3'; }, 'tasks' => ['task1'], // Run after task1 ], 'task4' => [ 'method' => function () { return 'result3'; }, 'tasks' => ['task2'], // Run after task2 ], ]; Async::run($tasks) ->then(function ($results) { print_r($results); }) ->catch(function ($error) { echo 'Error: ' . $error->getMessage(); });
License
This source code project is licensed under the MIT license.
Creator
邱敬幃 Pardn Chiu
©️ 2024 邱敬幃 Pardn Chiu
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-02