php-concurrency
Guidance for using PHP Fibers and asynchronous programming for concurrent execution.
Install
mkdir -p .claude/skills/php-concurrency && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10796" && unzip -o skill.zip -d .claude/skills/php-concurrency && rm skill.zipInstalls to .claude/skills/php-concurrency
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Implement concurrency and non-blocking I/O in modern PHP. Use when implementing concurrent requests, async processing, or non-blocking I/O in PHP. (triggers: **/*.php, Fiber, suspend, resume, non-blocking, async)Key capabilities
- →Implement Fiber multitasking
- →Set up non-blocking I/O
- →Handle concurrent API requests
How it works
It uses PHP Fibers for cooperative multitasking and event loops for non-blocking I/O.
Inputs & outputs
When to use php-concurrency
- →Implement Fiber multitasking
- →Set up non-blocking I/O
- →Handle concurrent API requests
About this skill
PHP Concurrency
Priority: P2 (MEDIUM)
Structure
See implementation examples for directory layout.
Implement PHP Fibers (8.1+)
- Multitasking: Use
new Fiber()for low-level cooperative multitasking. - Yielding Control: Use
Fiber::suspend('paused')to yield execution back to the caller. - Resuming: Call
$fiber->resume('hello')to continue execution. Catch exceptions via * *$fiber->getReturn()**. - Isolation: Use separate PDO connections per Fiber to avoid shared mutable state.
See implementation examples for Fiber cooperative multitasking code.
Configure Non-blocking I/O & Event Loops
- Loop Setup: Use ReactPHP or Amp. Call
Loop::get()to access the event loop. - HTTP Clients: Use
react/httpor the GuzzlePool($client, ...)for concurrent requests. - I/O Safety: Never use blocking
file_get_contentsorsleep()inside a Fiber or EventLoop. - Entry Point: Run
Loop::run()at your application entry point to start the async loop.
See implementation examples for concurrent HTTP requests with Guzzle Pool.
Choose Concurrency Strategies
- Queued Jobs: For heavy concurrency, prefer Laravel Horizon or Symfony Messenger over raw PHP Fibers.
- Self-Contained Logic: Ensure Fibers manage their own state and exceptions to prevent cross-contamination.
Anti-Patterns
- No deeply nested Fiber suspends: Keep Fiber logic traceable.
- No blocking I/O inside Fibers: Use async-compatible libraries.
- No custom scheduler code: Use Amp or ReactPHP instead.
References
When not to use it
- →Blocking I/O
- →Custom scheduler code
Prerequisites
Limitations
- →Requires async-compatible libraries
How it compares
It enables async patterns in PHP rather than relying on synchronous blocking code.
Compared to similar skills
php-concurrency side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| php-concurrency (this skill) | 0 | 4mo | No flags | Advanced |
| pulse-development | 0 | 3mo | Review | Intermediate |
| wordpress | 0 | 2mo | No flags | Advanced |
| wordpress-pro | 0 | 2mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by li-lance
View all by li-lance →You might also like
pulse-development
THM-Health
Handles Laravel Pulse setup, configuration, and custom card development. Activates when installing Pulse; configuring the dashboard or authorization gate; setting up recorders and filtering; building custom Livewire cards; optimizing with Redis ingest or sampling; or when the user mentions /pulse, p
wordpress
FISCFED9
Complete WordPress development workflow covering theme development, plugin creation, WooCommerce integration, performance optimization, and security hardening. Includes WordPress 7.0 features: Real-Time Collaboration, AI Connectors, Abilities API, DataViews, and PHP-only blocks.
wordpress-pro
trongquach
Develops custom WordPress themes and plugins, creates and registers Gutenberg blocks and block patterns, configures WooCommerce stores, implements WordPress REST API endpoints, applies security hardening (nonces, sanitization, escaping, capability checks), and optimizes performance through caching a
woocommerce-code-review
woocommerce
Review WooCommerce code changes for coding standards compliance. Use when reviewing code locally, performing automated PR reviews, or checking code quality.
laravel-pdf
spatie
Generate PDFs from Blade views or HTML using spatie/laravel-pdf. Covers creating, formatting, saving, downloading, and testing PDFs with the Browsershot, Cloudflare, or DOMPDF driver.
woocommerce-backend-dev
woocommerce
Add or modify WooCommerce backend PHP code following project conventions. Use when creating new classes, methods, hooks, or modifying existing backend code. **MUST be invoked before writing any PHP unit tests.**