Request lifecycle
PAM boots Laravel once, then creates a request sandbox around the booted application for every HTTP request or Socket callback.
One-time worker boot
Section titled “One-time worker boot”The worker loads:
bootstrap/app.php;- configuration;
- service providers;
- package discovery;
- routes;
- the HTTP kernel; and
- long-lived framework infrastructure.
Development reload restarts the child when PHP source, routes, configuration, .env, or Composer metadata changes. vendor, storage, and bootstrap/cache are ignored as generated directories.
Per-request sequence
Section titled “Per-request sequence”For every request PAM:
- creates an Illuminate request from the native request and isolated superglobals;
- clones the booted application container into a sandbox;
- points the kernel, router, events, Bus pipeline, Eloquent, managers, facades, validator, translator, and scoped bindings at that sandbox;
- executes middleware, routing, controllers, exceptions, and response conversion;
- streams or writes the response through the native transport;
- invokes terminating callbacks after completion or cancellation;
- flushes facades, controllers, guards, queued cookies, views, query logs, log context, locale-sensitive services, and scoped bindings;
- destroys the sandbox; and
- restores the root application.
Concurrency boundary
Section titled “Concurrency boundary”Laravel managers, facades, routing, and many packages keep mutable process-global state. PAM enforces:
maxConcurrentRequests = 1 per Laravel workerThe same slot covers Socket callbacks. PAM rejects an unsafe override during startup.
Scale with several workers:
pam start pam.php --workers "$(nproc)"An excess request presented to a busy Laravel worker receives 503. An edge may retry an idempotent method; do not automatically replay non-idempotent writes without an idempotency contract.
What PAM resets
Section titled “What PAM resets”The Laravel host resets framework-owned request state including facades, scoped bindings, guard resolution, cookies, view state, query logs, logging context, locale-sensitive services, controllers, and request injection through Events and Bus.
What application code must avoid
Section titled “What application code must avoid”Do not retain any of these across requests:
Illuminate\Http\Requestor Symfony request objects;- authenticated users, guards, or authorization decisions;
- tenant or locale selection;
- responses, streams, uploaded files, or sessions;
- active database transactions;
- query-builder instances bound to request state; or
- request-specific values in static properties.
PAM cannot infer the meaning of arbitrary application globals.
Streamed and binary responses
Section titled “Streamed and binary responses”StreamedResponse and BinaryFileResponse are not accumulated in PHP memory. PAM writes 64 KiB chunks into a bounded native queue, applies client backpressure, supports HEAD and byte ranges, and cancels the request Fiber on disconnection.
maxResponseBytes and maxResponseChunkBytes are hard transport boundaries. The generated pam.php includes conservative defaults that should be adjusted to the application’s legitimate largest response.