Skip to content

Laravel on PAM

PAM runs your Laravel application the way you already write it, but without PHP-FPM. Instead of booting the framework on every request, PAM boots it once per worker process, keeps it in memory, and hands each request a clean, isolated copy of the service container. Your routes, controllers, Eloquent models, queues, and Composer packages stay exactly the same.

You get three things out of that:

  • Speed. Configuration, service providers, and routes are loaded once per worker, not once per request.
  • One binary. PAM is the HTTP server, the PHP runtime (embedded PHP 8.5), Composer, and the process supervisor. There is no Nginx-to-FPM socket to tune.
  • Production operations. Zero-downtime reloads, health and readiness endpoints, Prometheus metrics, worker recycling, and atomic releases are built in.

The Laravel integration has two layers:

Layer Ships in What it does
Pam\Laravel\Application The pam binary Boots Laravel once, isolates every request, streams responses
pushinbr/pam-laravel Composer package (optional) State guard, health and metrics routes, OTLP traces, process manifest, deploy and diagnostics commands

You can run Laravel on PAM with only the first layer. Add the package when you want the production tooling.

If PAM is already installed (installation guide), a new Laravel application is one command away:

Terminal window
pam init example-app --template laravel
cd example-app
pam dev pam.php

Then, in another terminal:

Terminal window
curl http://127.0.0.1:3000/api/ping
# {"message":"pong"}

pam dev watches your code and reloads the worker when a PHP file, route, config file, .env, or Composer metadata changes.

┌──────────────────────── pam start pam.php --workers 4 ──┐
client ───▶ │ PAM master (Rust, owns the listening socket) │
│ ├─ worker 1: Laravel booted once ─▶ request sandbox │
│ ├─ worker 2: Laravel booted once ─▶ request sandbox │
│ ├─ worker 3: ... │
│ └─ worker 4: ... │
└─────────────────────────────────────────────────────────┘
  1. The master process owns the port and supervises N worker processes.
  2. Each worker requires bootstrap/app.php, bootstraps the HTTP kernel, loads configuration, providers, and routes, then waits for traffic.
  3. For each request the worker clones the booted container into a sandbox, runs the request through the normal Laravel kernel, sends the response, runs terminating callbacks, then throws the sandbox away.
  4. Each worker serves one Laravel request at a time. You get concurrency by running several workers.

The Request Lifecycle page explains exactly what survives between requests and what does not. Read it before you go to production.

Terminal window
pam start pam.php --workers 8 --admin-address 127.0.0.1:3010

One process tree. Laravel boots once per worker, PAM serves HTTP itself, and the admin listener exposes /live, /ready, and /metrics.

Component Supported
Laravel 12.x and 13.x
PHP (embedded in PAM) 8.5 by default, 8.4 supported
pushinbr/pam-laravel requires PHP ^8.4, Laravel ^12.0 || ^13.0
pushinbr/pam-octane Laravel Octane 2.19 or newer

The steps in these docs were verified with PAM 2.2.27, embedded PHP 8.5.13, Laravel 13.45, and pushinbr/pam-laravel 0.1.49.