Skip to content

Installation

There are two ways to start: create a fresh Laravel application with pam init, or add one small entrypoint file to an application you already have. Either way, your Laravel code does not change. PAM only needs:

  • the pam binary (it includes PHP 8.5 and Composer); and
  • a pam.php file in the project root that boots Laravel and starts listening.

Install the binary and check the toolchain:

Terminal window
curl -fsSL https://pamphp.com/install | sh
pam --version
pam doctor

See the main installation guide for macOS, Windows, and pinned versions. You do not need a system PHP or Composer: use pam composer and pam artisan everywhere.

  1. Create the project:

    Terminal window
    pam init example-app --template laravel
    cd example-app

    PAM downloads the official Laravel skeleton, installs its dependencies, generates APP_KEY, creates the SQLite database, and runs the default migrations. On top of the stock skeleton it adds:

    File Change
    pam.php The PAM entrypoint
    routes/api.php A stateless GET /api/ping route
    bootstrap/app.php Registers routes/api.php and renders JSON errors for api/*
    composer.json pam:dev and pam:start scripts

    Add --socket to also register PAM’s native WebSocket transport on the same listener.

  2. Start the development server:

    Terminal window
    pam dev pam.php
  3. Call the API:

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

Any Laravel 12 or 13 application that boots with php artisan serve can run on PAM.

  1. Install dependencies with PAM’s Composer, from the project root:

    Terminal window
    pam composer install
  2. Create the entrypoint:

    pam.php
    <?php
    declare(strict_types=1);
    use Pam\Laravel\Application;
    $app = Application::boot(__DIR__);
    $app->listen(
    port: (int) (getenv('PAM_PORT') ?: 3000),
    host: (string) (getenv('PAM_HOST') ?: '127.0.0.1'),
    options: [
    // Laravel managers and facades are process-global. PAM keeps one request
    // active per worker and scales safely with `pam start --workers N`.
    'maxConcurrentRequests' => 1,
    'responseStreamQueueCapacity' => 16,
    'maxResponseBytes' => 256 * 1024 * 1024,
    'maxResponseChunkBytes' => 1024 * 1024,
    'exposeErrors' => filter_var(
    getenv('APP_DEBUG') ?: 'false',
    FILTER_VALIDATE_BOOLEAN,
    ),
    ],
    );

    This is the exact file pam init generates. Pam\Laravel\Application is built into the pam binary, so there is nothing to require.

  3. Run it:

    Terminal window
    pam dev pam.php

    Your existing routes now answer on http://127.0.0.1:3000. Set PAM_PORT and PAM_HOST to listen elsewhere.

  4. Use PAM for Artisan too:

    Terminal window
    pam artisan migrate
    pam artisan route:list

pushinbr/pam-laravel adds production tooling on top of the runtime: a request state guard, health and metrics routes, OpenTelemetry traces, a process manifest for queues and the scheduler, deployment commands, and an MCP server.

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

Package discovery registers Pam\Laravel\PamServiceProvider automatically. pam:install publishes these files:

File Purpose
config/pam.php Package configuration (reference)
pam.processes.json HTTP, queue, and scheduler process manifest
docker-compose.pam.yml Docker Compose starting point
deploy/pam.service systemd unit starting point
deploy/kubernetes.yaml Kubernetes Deployment starting point
deploy/forge-deploy.sh Laravel Forge deployment script starting point
.pam/laravel.json The chosen preset, stored as an integer (api = 1, livewire = 2, inertia = 3, realtime = 4)

Pass --force to overwrite files you already published.

Then check what still needs attention:

Terminal window
pam artisan pam:check-production

On a fresh local project this fails environment, debug, and config-cache, which is expected outside production. See the Production Checklist.

Use the PAM-prefixed equivalents of the tools you already know:

Instead of Use
composer install pam composer install
php artisan migrate pam artisan migrate
php artisan serve pam dev pam.php
php artisan test pam artisan test or pam test
php-fpm + Nginx pam start pam.php --workers N

pam artisan runs Artisan in PAM’s embedded PHP with a real console identity: runningInConsole() is true, arguments, standard streams, and exit codes work normally, and packages register their console commands as usual.