# PHP Concurrency

> Handling concurrency and non-blocking I/O in modern PHP.

- Skill: `majiayu000/php-concurrency` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add majiayu000/php-concurrency`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/php-concurrency/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/php-concurrency

---


# PHP Concurrency

## **Priority: P2 (MEDIUM)**

## Structure

```text
src/
└── Async/
    ├── Schedulers/
    └── Clients/
```

## Implementation Guidelines

- **Fibers**: Use `Fiber` for low-level cooperative multitasking (8.1+).
- **Yield Control**: Apply `Fiber::suspend()` to yield within Fibers.
- **I/O Bound**: Target I/O tasks only; avoid for CPU intensive work.
- **Frameworks**: Prefer **Amp** or **ReactPHP** for complex events.
- **Self-Contained**: Ensure Fibers manage their own state/exceptions.
- **Incremental**: Refactor single bottlenecks before full async.

## Anti-Patterns

- **Implicit Flows**: **No Deep Suspend**: Keep Fiber logic traceable.
- **Internal Blocking**: **No Blocking I/O**: Don't block inside Fibers.
- **Custom Schedulers**: **No DIY Schedulers**: Use proven async libs.

## References

- [Fiber Implementation Guide](references/implementation.md)

