← Back to list

Since PHP lacked a solid microservice framework, I decided to build Valhalla.

I’ve been writing PHP microservices for years. And every time I started a new internal service, I faced the same three bad choices:

Yassine Ait sidi brahim · 2026-04-25 13:23 · 7 claps · 2.1 min read
#php #microsoft #fireworks #valhalla #claude
Open on Medium ↗
Wiki topics: LLM · Large Language Models

Since PHP lacked a solid microservice framework, I decided to build Valhalla.

I’ve been writing PHP microservices for years. And every time I started a new internal service, I faced the same three bad choices:

Laravel — too heavy. You get Eloquent, Blade, queues, broadcasting, and 30MB of vendor code for a service that just needs to return JSON.

Slim — too bare. You get a router and a PSR-7 container. That’s it. You wire everything yourself every single time.

Lumen — deprecated. Laravel officially killed it.

There’s no middle ground in PHP for microservices. In Node.js you have Fastify. In Python you have FastAPI. In Go the standard library almost does the job. In PHP? Nothing that fits.

So I built Valhalla.

What Valhalla is

A microservices-first PHP framework. ~300KB. Two runtime dependencies. Boots in milliseconds.

It covers exactly the things you always need when building an internal service — and nothing else:

  • JSON-first routing — closure or controller style, route groups, named routes
  • JWT + API token auth — protect routes with one line of middleware
  • ServiceClient — typed HTTP client for calling other services, with retries and timeouts
  • Local Agents — TCP-based background workers, MCP-style, running on-box
  • CLI scaffolding — generate controllers, middleware, services, and sign JWTs from your terminal

Install and run in 4 commands

composer global require asyassin10/valhalla-framework
valhalla new project orders-service
cd orders-service && composer install
php -S 127.0.0.1:8080 -t public

Hit /health:

json

{
  "ok": true,
  "service": "orders",
  "uptime_ms": 1284
}

CLI Commands

valhalla new project <name>          # scaffold a new service
valhalla make:controller <name>      # generate a controller
valhalla make:middleware <name>      # generate a middleware
valhalla make:service <name>         # generate a service class
valhalla routes:list                 # inspect all registered routes
valhalla auth:generate 1 "Jane Doe"  # sign a JWT from the terminal
valhalla agent:install <name> <port>
valhalla agent:start <name>
valhalla agent:call <name> <action>

How I built it

I built it mostly on my own. I used Claude as a thinking partner throughout — reviewing architecture decisions, discussing tradeoffs, and helping me write cleaner code and docs. It made the whole process faster and more honest. When you explain a design decision to an AI that pushes back, you either improve the decision or understand why it was right.

What’s next: building the ORM

This is the part I’m genuinely nervous about.

Adding an ORM to a microservices framework is a real design challenge. Most ORMs are written for monoliths — they assume a single connection, a single database, a long lifecycle. In a microservice world you want something lighter: connection pooling per service, query builder without magic, no global state.

I’m going to build one from scratch. It has to feel native to Valhalla — not a port of Doctrine or a stripped-down Eloquent. That means making hard decisions about what it should and shouldn’t do.

I’ll write about the process as I go.

Requirements: PHP 8.2+ · Composer

🔗 GitHub: github.com/asyassin10/valhalla-framework

🌐 Docs: https://www.valhalla-fremwrok.space/


메타데이터
post_id
d09d09e650af
slug
valhalla-i-built-a-microservices-php-framework-from-scratch-heres-why-d09d09e650af
url
https://medium.com/@yassineaitsidibrahim/valhalla-i-built-a-microservices-php-framework-from-scratch-heres-why-d09d09e650af
canonical_url
https://medium.com/@yassineaitsidibrahim/valhalla-i-built-a-microservices-php-framework-from-scratch-heres-why-d09d09e650af
author_url
https://medium.com/@yassineaitsidibrahim
status
ok
fetched_at
2026-07-16 11:16:19