Được TopGit lập chỉ mục từ metadata GitHub: nunomaduro/pokio có 767 sao, viết chủ yếu bằng PHP. Pokio is a dead simple Asynchronous API for PHP that just works.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Caution: This package manipulates process lifecycles using low-level and potentially unsafe techniques such as FFI for inter-process communication, and preserving state across process spawns. It is intended strictly for internal use (e.g., performance optimizations in Pest). Don't use this in production or use at your own risk—no guarantees are provided.
Pokio
Pokio is a dead simple Asynchronous API for PHP that just works! Here is an example:
Behind-the-scenes, Pokio uses the PCNTL extension to fork the current process and run the given closure in a child process. This allows you to run multiple tasks concurrently, without blocking the main process.
Also, for communication between the parent and child processes, Pokio uses FFI to create a shared memory segment, which allows you to share data between processes fast and efficiently.
However, unlike other libraries, if PCNTL or FFI are not available, Pokio will automatically fall back to sequential execution, so you can still use it without any issues.
Installation
Requires PHP 8.3+.
⚡️ Get started by requiring the package using Composer:
composer require nunomaduro/pokio
Usage
async
The async global function returns a promise that will eventually resolve the value returned by the given closure.
Similar to other promise libraries, Pokio allows you to chain methods to the promise (like then, catch, etc.).
The then method will be called when the promise resolves successfully. It accepts a closure that will receive the resolved value as its first argument.
$promise = async(fn (): int => 1 + 2)
->then(fn ($result): int => $result + 2)
->then(fn ($result): int => $result * 2);
$result = await($promise);
var_dump($result); // int(10)
Optionally, you may chain a catch method to the promise, which will be called if the given closure throws an exception.
Similar to the catch method, you may also chain a finally method to the promise, which will be called regardless of whether the promise resolves successfully or throws an exception.
$promise = async(function (): void {
throw new RuntimeException('Exception 1');
})->finally(function () use (&$called): void {
echo "Finally called\n";
});
If you return a promise from the closure, it will be awaited automatically.
nunomaduro/pokio thuộc nhóm Backend trên TopGit. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về nunomaduro/pokio ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/nunomaduro/pokio là nguồn chính thức.
nunomaduro/pokio có bao nhiêu sao?
nunomaduro/pokio có 767 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/nunomaduro/pokio. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
nunomaduro/pokio có phải mã nguồn mở không?
Có — nunomaduro/pokio phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/nunomaduro/pokio.
nunomaduro/pokio có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho nunomaduro/pokio. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
nunomaduro/pokio có trang demo không?
Dự án có trang chủ ở https://youtube.com/@nunomaduro?sub_confirmation=1. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
nunomaduro/pokio còn đang phát triển không?
Commit gần nhất trên nunomaduro/pokio là 19 ngày trước (theo timestamp GitHub). Repo có 39 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về pokio?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về pokio.