mir-backend-phplisted
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