Build robust, high-performance Modular Monoliths while your AI Agent does the heavy lifting.
| Problem | Solution |
|---|---|
| Complex layered architecture | Vertical Slices β code grouped by business value |
| Nginx + FPM configuration hell | FrankenPHP Worker Mode β one binary, HTTP/3, 2ms latency |
| AI generates spaghetti code | AI-Native structure β agents understand context instantly |
| Code review debates | Pint + PHPStan Level 9 β tools decide, humans review logic |
| Fear of deletion | Rule of Deletion β optimized for removal, not reuse |
# Here the PHP Cheat Code for 2026
# 1. Clone and ignite
git clone https://github.com/k2gl/pragmatic-franken.git && cd pragmatic-franken
# 2. The Magic Command
make installBoom! Your app is live at https://localhost with automatic HTTPS.
This repo is Agent-Native. OpenCode, Cursor, Windsurf, and Copilot understand your architecture better than you do.
@AGENTS.md Implement a new 'Subscription' module following our architecture.The AI Agent will:
- Analyze ADRs β Reads architecture decisions for consistency
- Scaffold & Code β Creates folders per Vertical Slice patterns
- Verify β Runs
make checkto ensure nothing is broken - Deliver β Prepares a PR, ready for your review
First Feature: Try implementing real business logic (Telegram auth, Stripe integration) using @AGENTS.md. You'll be amazed how simple it became.
| Check | Tool | Command |
|---|---|---|
| Code Style | Pint | make lint |
| Static Analysis | PHPStan Level 9 | make analyze |
| Tests | PHPUnit | make test |
| All Checks | CI Pipeline | make check |
| Feature | Traditional | Pragmatic Franken |
|---|---|---|
| Web Server | Nginx + FPM | FrankenPHP (single binary) |
| Latency | ~50-100ms | ~2ms (Kernel stays in memory) |
| HTTP Protocol | HTTP/1.1 | HTTP/3 (built-in) |
| Configuration | 5 config files | One Caddyfile |
| Layer | Legacy | Pragmatic |
|---|---|---|
| Web Server | Nginx + FPM | FrankenPHP |
| Process Manager | Supervisord | Worker Mode |
| Scheduler | Crontab | Symfony Scheduler |
| Graceful Shutdown | Manual config | Out of the box |
4 configs = 4 failure points. 1 Caddyfile = 1 source of truth.
FrankenPHP Worker Mode vs PHP-FPM benchmarks:
| Metric | PHP-FPM | FrankenPHP Worker | Source |
|---|---|---|---|
| Cold Boot | ~150ms | ~10ms | FrankenPHP |
| Requests/sec | ~500 | ~8,000 | TechEmpower |
We don't do "because I said so". Every decision is documented:
| ADR | Topic | Priority |
|---|---|---|
| 0001 | Vertical Slices Architecture | P0 |
| 0002 | Messenger Transport (CQRS) | P0 |
| 0003 | Pragmatic Symfony | P0 |
| 0004 | FrankenPHP Runtime | P1 |
| 0005 | Health Checks | P1 |
| 0006 | Memory Management | P2 |
| 0007 | AssetMapper | P2 |
| 0008 | Testing Strategy (PHPUnit) | P1 |
| 0009 | Shared Architecture | P1 |
We don't do "folders by type" (all controllers in one place, all models in another). That's 2010. We group by Business Value.
src/
βββ Kernel.php # System core (Symfony MicroKernel)
βββ Shared/ # Global Shared (infrastructure only)
β βββ Infrastructure/
β β βββ Bus/ # Messenger configuration
β β βββ Persistence/ # Doctrine extensions
β β βββ Logging/ # Sentry, monitoring
β βββ Domain/
β βββ ValueObject/ # Global value objects
β βββ Exception/ # Base exceptions
β
βββ User/ # Module (Bounded Context)
β βββ Entity/ # User.php
β βββ Enum/ # UserRole.php
β βββ Service/ # PasswordHasher.php
β βββ Events/ # UserRegisteredEvent.php
β βββ Repositories/
β βββ Features/ # Vertical Slices (Business logic here π)
β βββ {FeatureName}/
β βββ {FeatureName}Action.php # Entry point (HTTP/CLI)
β βββ {FeatureName}Handler.php # Business logic
β βββ {FeatureName}Dto.php # Data transfer
β βββ {FeatureName}Test.php # Local feature test
β
βββ Task/ # Module (same pattern)
βββ Board/ # Module (same pattern)
βββ Health/ # Technical feature (same pattern)
See ADR-0009 for Shared architecture rules.
- Locality of Change: Want to change "User Registration"? Everything is in one folder. No jumping around 10 directories.
- Zero Side Effects: Delete a folder β the entire feature is gone. No ghost code left behind.
- AI-Friendly: Your AI Agent finds context instantly. It doesn't have to scan the whole src/Controllers folder to find one specific action.
- Low Cognitive Load: You focus on the feature, not the framework.
How we write code:
- Create a Feature Slice
- Define a Command or Query
- Handle it
No over-engineering.
Stop wasting time on boilerplate. Use our generators to keep the architecture clean and consistent:
# Create a new Vertical Slice (Action + Handler + DTO + Test)
make slice module=Billing feature=Subscribeflowchart TD
A[HTTP Request] --> B[Controller / EntryPoint]
B --> C[Command / Query]
C --> D[Handler]
D --> E[Entity / Domain]
D --> F[Repository]
E --> G[Domain Event]
G --> H[Event Bus]
H --> I[Async Handlers]
H --> J[Mercure / Real-time]
subgraph Persistence
F --> K[(PostgreSQL)]
end
subgraph Cache
D --> L[(Redis)]
end
See ADR 0002 for Message Bus implementation details.
| Quarter | Focus | What's Coming |
|---|---|---|
| Q1 | Real-time & Connectivity | Mercure Hub, Event Sourcing Lite, TypeScript SDK Generator |
| Q2 | AI & Agentic Autonomy | Self-Healing CI, Interactive Scaffolding, Context Injection |
| Q3 | Edge & Performance | Static Binary Builds, Memory Management, SQLite + Litestream |
| Q4 | Frontend & Ecosystem | HTMX/LiveWire Presets, Public Templates Marketplace |
See Contributing Guidelines for details.
Build for 2026, not 2015. FrankenPHP is the engine, Symfony is the brain, AI is the hands.