Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pokio Laravel Package

nunomaduro/pokio

Pokio is a minimal async API for PHP. Run closures concurrently using PCNTL forking and shared-memory IPC via FFI, then await results like promises. Built for internal tooling/perf work (e.g., Pest). Not production-safe; use at your own risk.

View on GitHub
Deep Wiki
Context7

Pokio is a dead simple Asynchronous API for PHP that just works.

Frequently asked questions about Pokio
Can I use Pokio to speed up Laravel migrations or Artisan commands?
Yes! Pokio lets you parallelize blocking operations like database queries or API calls in migrations or Artisan commands. For example, run multiple `Schema::table()` calls concurrently by wrapping them in `async()` and awaiting results. Just ensure tasks are stateless and under 5 minutes.
Will Pokio work with Laravel 10 or 11?
Pokio is compatible with Laravel 10 and 11, but it requires PHP 8.3+. It integrates seamlessly with Artisan commands and testing frameworks like Pest. Check the [GitHub repo](https://github.com/nunomaduro/pokio) for the latest Laravel version support.
How do I install Pokio in a Laravel project?
Install via Composer: `composer require nunomaduro/pokio`. Requires PHP 8.3+ and the `pcntl` and `ffi` extensions. If extensions are missing, Pokio falls back to sequential execution gracefully. Verify with `php -m | grep -E 'pcntl|ffi'` before installing.
Is Pokio safe for production use?
No, Pokio is **not production-safe**. It’s designed for internal tooling, CI/CD, or local development (e.g., Pest test parallelization). It lacks retries, dead-letter queues, and distributed coordination. Use Laravel queues or Symfony Messenger for production async tasks.
How does Pokio handle database connections in parallel tasks?
Shared database connections can cause race conditions. Pokio doesn’t manage connections automatically, so you must manually disconnect after tasks: `DB::disconnect()` in a `finally()` block. For safety, use transactions or explicit locks for shared resources.
Can I debug Pokio-powered Artisan commands with Xdebug?
Yes! Pokio auto-disables forking in debug mode (XDEBUG_SESSION=1). Child processes won’t interfere with debugging. However, debug sessions may slow down parallel execution, so test thoroughly in CI/local environments.
What’s the maximum number of parallel tasks Pokio can handle?
Pokio doesn’t enforce limits, but your OS and PHP process limits apply. Monitor `ulimit -u` (Linux/macOS) or task manager tools. For CI, start with 4–8 parallel tasks and adjust based on available CPU/memory. Avoid exceeding system limits to prevent crashes.
How do I handle errors in async tasks?
Use `catch()` and `finally()` with promises, just like JavaScript. Example: `await(async(fn() => sleep(1)))->catch(fn($e) => error_log($e))->finally(fn() => cleanup());`. Nested errors may propagate uncleanly, so wrap critical tasks in try-catch blocks.
Are there alternatives to Pokio for Laravel async tasks?
For production, use Laravel queues (database/Redis) or Symfony Messenger. For local/dev, consider `spatie/async` (simpler) or `reactphp` (event-loop based). Pokio’s strength is its minimal async/await syntax, but it lacks production features like retries or clustering.
Will Pokio work in shared hosting or Docker containers?
Pokio requires `pcntl` and `ffi`, which may not be available in shared hosting. In Docker, ensure the PHP image includes these extensions (e.g., `php:8.3-cli-pcntl-ffi`). Test fallbacks by disabling extensions temporarily to confirm graceful degradation.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai