performant-laravel
Installation
SKILL.md
Performant Laravel Skill
Goal
Optimize Laravel applications for high-throughput, sub-100ms response times, and horizontal scalability using modern runtimes and efficient data patterns.
Capabilities
1. Database Performance (Eloquent & Query Builder)
- Zero N+1 Policy: Mandatory use of eager loading (
with()) for all relationships. UsepreventLazyLoading()in development. - Data Selection: Use
select()to retrieve only required columns. Never use*for large tables. - Large Dataset Handling: Use
chunk()orlazy()for processing large records. UsecursorPaginate()for infinite scroll or high-offset pagination. - Indexing Strategy: Ensure all foreign keys and columns used in
WHERE,ORDER BY, andGROUP BYare appropriately indexed.
2. High-Performance Runtimes
- Laravel Octane: Power applications with Swoole or RoadRunner to eliminate the boot overhead of traditional PHP-FPM.
- FrankenPHP: Use the modern PHP app server (Go-based) with 103 Early Hints and worker mode support.
- OPcache & Preloading: Ensure OPcache is tuned and use PHP 7.4+ preloading to keep the framework in memory.