Why I Built NexPHP: Modern PHP with Less Code, More Power, and Zero Magic

PHP in 2026 is unrecognizable from what it was a decade ago. With PHP 8.3+, strict types, enums, readonly properties, attributes, and Fibers, the language itself has become one of the fastest, most reliable backends on the web.

Yet, many framework ecosystems still rely on architectural conventions invented in 2011:

  • Facades and global state.
  • Dynamic magic methods that confuse static analysis and AI coding tools.
  • Architecture solely centered on the classic FPM "shared-nothing" model.

That is why I created NexPHP: a modern framework designed from scratch around two realities:

  1. Modern runtimes (FrankenPHP and long-lived persistent workers).
  2. AI-assisted "vibe-coding" (where explicit types and zero magic lead to effortless AI collaboration).

The Core Principles

1. Zero Magic, Strict Types

No hidden metaprogramming. If a controller action expects a validated request, you simply typehint your FormRequest subclass:

#[Post('/products')] public function store(CreateProductRequest $request): ResponseInterface { // $request is automatically resolved, validated, and injected. // If validation fails, a 422 JSON response is returned automatically. $data = $request->validated(); return new JsonResponse(['status' => 'created'], 201); } 

Because everything has explicit types and attributes, AI models (Cursor, Windsurf, Copilot) generate working code on the first attempt without guessing.

2. Dual-Runtime Readiness

In persistent worker mode, PHP keeps the application in memory. If not designed carefully, user identity or database state can leak across requests.

NexPHP features built-in request-scope isolation:

  • Singletons live across the worker lifetime.
  • Scoped bindings (current user, request, CSRF) are automatically wiped via $app->forgetScoped() after each response.

In benchmarks, NexPHP achieves:

  • ~218,000 req/sec in persistent worker mode.
  • 0.00 MB memory growth over a 10,000-request soak test.

3. Native Fiber Concurrency

No complex asynchronous event loops. You can run concurrent I/O operations cooperatively using PHP Fibers:

use Nex\Concurrency\Scheduler; $scheduler = new Scheduler(); $results = $scheduler->all([ 'user' => fn () => $httpClient->get('https://api.example.com/user'), 'order' => fn () => $httpClient->get('https://api.example.com/order'), ]); 

4. Full-Stack Services Included

NexPHP includes everything needed for production SaaS applications:

  • Queues: Database-backed queue with exponential retry backoff and failed-job dead-letter stores.
  • Scheduler: Cron-like DSL (dailyAt('02:00')) with lock-based overlap prevention.
  • Security: Sliding-window rate limiting, CSRF verification, and CORS preflight handling.
  • Observability: PSR-3 structured JSON logging with automatic secret redaction (password, token), and Prometheus metrics exporter.

Try It Out in 30 Seconds

You can start a new project right now via Composer:

composer create-project nexphp/nexphp my-api cd my-api php bin/nex serve 

I’d love to hear your thoughts, feedback, and pull requests!