https://github.com/pardnchiu/php-async
PD\Async is a PHP library using ReactPHP to perform asynchronous tasks, supporting task dependency handling and topological sorting.
https://github.com/pardnchiu/php-async
async pardnchiu pardnio pardnltd php-composer php-library
Last synced: about 2 months ago
JSON representation
PD\Async is a PHP library using ReactPHP to perform asynchronous tasks, supporting task dependency handling and topological sorting.
- Host: GitHub
- URL: https://github.com/pardnchiu/php-async
- Owner: pardnchiu
- License: mit
- Created: 2024-09-02T14:26:52.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-03T08:56:33.000Z (3 months ago)
- Last Synced: 2025-03-03T22:41:27.321Z (2 months ago)
- Topics: async, pardnchiu, pardnio, pardnltd, php-composer, php-library
- Language: PHP
- Homepage:
- Size: 23.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PD\Async
> 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 PHP
- `react/event-loop` - Event Loop Library for PHP## How to Use
### Install
```SHELL
composer require pardnchiu/async
``````php
[
'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](https://github.com/pardnchiu/PHP-Async/blob/main/LICENSE) license.
## Creator
邱敬幃 Pardn Chiu
***
©️ 2024 [邱敬幃 Pardn Chiu](https://pardn.io)