← ClaudeAtlas

mir-backend-phplisted

Make It Right (PHP runtime tier). Zend Engine / PHP 8.2+ runtime reliability footguns that are shared across EVERY PHP backend framework (Laravel, Symfony, WordPress, Slim, Lumen) — distinct from the generic backend gates and from any one framework's mechanics. Covers: shared-nothing request lifecycle and why static/global state does not persist, FPM worker model and concurrency = pm.max_children (not threads), long-running runtime modes (Swoole/RoadRunner/FrankenPHP/Octane) and the state-bleed/memory-leak inversion they introduce, max_execution_time and memory_limit per request, opcache correctness in production, persistent DB connection caveats, and PHP's error/exception model in prod. TRIGGER when the backend runtime is PHP — sits between mir-backend (generic) and the framework module (e.g. mir-backend-php-laravel). SKIP for Node/JVM/Go/Rust/.NET/Python/Ruby/BEAM runtimes (each has its own mir-backend-<runtime> tier), and for framework-library mechanics (those live in the framework module).
anantbhandarkar/make-it-right · ★ 12 · AI & Automation · score 83
Install: claude install-skill anantbhandarkar/make-it-right
# /mir-backend-php · Make It Right (PHP runtime) The middle tier. `mir-backend` decides **what is correct** (any language). The framework module (e.g. `mir-backend-php-laravel`) knows the **library's mechanics**. This tier owns what's true for **all PHP backends because they run on the Zend Engine** — the request lifecycle and process model that Laravel, Symfony, WordPress, and Slim all inherit. **Runtime assumed:** PHP 8.2+ under PHP-FPM (the dominant production model). Long-running runtime notes (Swoole, RoadRunner, FrankenPHP, Laravel Octane) are called out explicitly because they **invert** several of the default rules. Load order: `mir-backend` → `mir-backend-php` → `<framework module>`. ## The PHP/Zend footguns AI walks into (framework-agnostic) ### 1. Shared-nothing per request — static/global state does NOT persist The Zend Engine tears down every variable, object, and static property at the end of each request. **Nothing in PHP process memory survives to the next request under FPM** — there is no "warm" in-process store between requests. - AI commonly writes `static $cache = []` inside a class, expecting it to persist across requests like an application-level cache. Under FPM each worker resets statics on every request — the "cache" is always empty at request start and is thrown away at request end. - **Fix:** persist data externally — opcache for compiled bytecode, APCu for small in-process per-worker caches (single worker only, not shared across workers), Red