<< All versions
Skill v1.0.0
LLM-judged scan90/100andreibesleaga/gabbe/performant-php
──Details
PublishedOctober 23, 2026 at 10:54 AM
Content Hashsha256:d75eb94705983308...
Git SHAda9e371a9413
──Files
Files (1 file, 3.8 KB)
SKILL.md3.8 KBactive
SKILL.md · 58 lines · 3.8 KB
version: "1.0.0" name: performant-php description: "High-performance modern PHP — PHP 8.4/8.5, OPcache+JIT, FrankenPHP workers, Composer, Symfony/Laravel, PHPStan/Psalm, Pest. Use when: php, php 8.4, php 8.5, composer, symfony, laravel, frankenphp, opcache, jit, phpstan, psalm, pest, phpunit, php performance." license: CC-BY-SA-4.0 metadata: source: "agents/skills/coding/performant-php.skill.md" tags: "coding, php, architecture" core: "false" context_cost: "medium"
Performant PHP Skill
Goal
Build fast, type-safe, maintainable PHP services using the current ecosystem (versions verified 2026-06-10). This is the language-level companion to performant-laravel.skill.md; use it for general PHP, Symfony, and framework-agnostic work.
Capabilities
1. Modern language baseline
- Target PHP 8.4+ (8.5 current stable). Use property hooks and asymmetric visibility (8.4) to remove boilerplate getters/setters; lazy objects (8.4) for deferred initialization; PDO driver-specific subclasses. On 8.5, the pipe operator `|>` chains callables and the built-in URI extension parses/normalizes URLs (RFC 3986 / WHATWG).
- Always
declare(strict_types=1);. Usereadonlyclasses/properties, enums (backed where serialized), first-class callable syntax, and constructor property promotion.
2. Runtime performance
- OPcache must be enabled in production; tune
opcache.memory_consumption,opcache.max_accelerated_files, andopcache.validate_timestamps=0(with deploy-time cache reset). - JIT (available 8.3+) more than doubles throughput on CPU-bound work (benchmarks ~+110%); negligible/negative for typical I/O-bound web requests — enable and measure, don't assume.
- FrankenPHP worker mode (Caddy-based app server) keeps the framework booted between requests — large latency wins for Laravel/Symfony; also gives Early Hints and real-time (Mercure). Alternative: RoadRunner or Swoole/OpenSwoole.
- Use
preloadfor hot framework classes.
3. Database & I/O
- Eliminate N+1: eager-load (Eloquent
with(), Doctrine fetch joins); add covering indexes; useEXPLAIN. - Stream large results with generators (
yield) to keep memory constant; chunk batch jobs. - Cache with Redis (PSR-6/PSR-16); use tags and explicit invalidation; queue slow work (Horizon / Symfony Messenger).
4. Type safety & quality gates
- PHPStan (aim level 8–9) or Psalm for static analysis; Rector for automated upgrades/refactors.
- Pint / PHP-CS-Fixer (PSR-12) for formatting; Deptrac for architectural layer enforcement.
- composer audit +
roave/security-advisoriesto block vulnerable dependencies.
5. Testing
- Pest (or PHPUnit) for unit + feature tests; PCOV/Xdebug for coverage; HTTP fakes for external calls; Testcontainers / sqlite-in-memory for integration.
6. Frameworks
- Laravel 12 (min PHP 8.2) — see
performant-laravel.skill.mdfor Octane/Eloquent specifics. - Symfony 7.4 (LTS, supported to 2028/2029) — autowiring, attributes, Messenger for async, API Platform for APIs; latest line is Symfony 8.x.
Steps
- Baseline: profile a representative request (Blackfire / Xdebug profiler /
phpbench) before changing anything. - Enable OPcache + JIT, measure, then add worker mode (FrankenPHP/RoadRunner) if request boot dominates.
- Kill N+1 and add indexes; cache the verified-hot, rarely-changing reads.
- Raise the static-analysis level (PHPStan/Psalm) and let it fail CI; apply Rector for safe upgrades.
- Re-profile and record the before/after numbers.
Sources (verified 2026-06-10)
- PHP 8.5 / 8.4 features: <https://www.php.net/releases/8.5/en.php> · <https://php.watch/versions>
- Laravel 12: <https://laravel.com/docs/12.x/releases>
- Symfony 7.4 LTS: <https://symfony.com/releases>
- FrankenPHP: <https://frankenphp.dev/>