Skip to content

Laravel on PAM

PAM runs an unmodified Laravel application in a persistent PHP Embed worker. Runtime integration classes live under Pam\Laravel; the pushinbr/pam-laravel package adds production presets, diagnostics, observability, process supervision, and deployment operations.

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

PAM downloads the official Laravel skeleton, installs its Composer dependencies, runs package discovery, creates the application key, and adds a stateless GET /api/ping route.

The maintained executable contract covers Laravel 12 and current Laravel 13 on PHP 8.4 Embed.

The matrix exercises boot, providers, middleware, routing, validation, exceptions, terminating callbacks, Eloquent, authentication, sessions, CSRF, uploads, streamed responses, binary responses, package discovery, and stable memory behavior.

PAM boots bootstrap/app.php, the HTTP kernel, providers, configuration, and routes once. For every request, it clones the application container into a sandbox, points framework managers and scoped services at that sandbox, handles the request, terminates it, flushes request state, destroys the sandbox, and restores the root application.

Application code must still avoid keeping the current request, authenticated user, tenant, response, or transaction in global or static state.

Laravel managers, facades, the router, and third-party packages contain mutable process-global state. PAM therefore enforces one concurrent Laravel request per worker, including Socket callbacks.

Terminal window
pam start pam.php --workers "$(nproc)"

Scale through multiple workers. A native PAM application does not inherit this Laravel-specific concurrency restriction.

Terminal window
pam artisan migrate
pam artisan route:list
pam artisan test
pam artisan queue:work

Queue workers, Horizon, and the scheduler are separate long-running console processes. Supervise them independently from the HTTP worker pool.

For a production-shaped application:

Terminal window
composer require pushinbr/pam-laravel
pam artisan pam:install --preset=api
pam artisan pam:check-production

Continue with the production platform.