laika-framework

Deployment

Entry Points

All web traffic must be routed through index.php — it loads lf-boot/app.php (constants, autoloader, hooks) and calls Url::dispatch(). Everything else in the project root should be unreachable directly.

Apache

.htaccess ships with the rewrite rule already in place:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteRule ^ index.php [QSA,L]
</IfModule>

Point your VirtualHost’s document root at the project root (not a public/ subdirectory — Laika serves index.php directly from the root).

nginx

Do not hand-write this. nginx.conf in the project root is generated, and php laika nginx:server prints a complete server block that includes it:

php laika nginx:make                                  # (re)generate nginx.conf
php laika nginx:server --domain=example.com --php=8.3 # full server block

nginx.conf holds the deny rules and the front-controller rewrite:

location / {
    if ($http_authorization != "") {
        set $auth_header $http_authorization;
    }

    rewrite ^ /index.php last;
}

Every request is rewritten to index.php, including ones that map to a real file, so the framework decides what may be served rather than nginx handing files out before PHP runs. The cost is that static assets go through PHP instead of nginx’s static path.

The server block must define location = /index.php. That is what terminates the rewrite above — without it nginx loops and returns 500. It also means no PHP file other than the front controller can ever be executed directly. php laika nginx:server emits it for you; keep the include of nginx.conf above it.

Pre-Deploy Checklist

Queue Worker

The worker executable (see Queue) is a long-running process, not a cron job — keep it alive with a process supervisor:

; /etc/supervisor/conf.d/laika-queue-worker.conf
[program:laika-queue-worker]
command=php /path/to/project/worker default
directory=/path/to/project
autostart=true
autorestart=true
numprocs=2
stopsignal=TERM

For more than one queue, add a separate program block (or numprocs group) per queue name. The worker self-restarts on memory pressure — supervisor/systemd just needs to bring it back up when it exits.

What Not to Deploy

CI

The framework and each laikait/* package run PHP 8.1–8.5 compatibility checks and lint on every push via GitHub Actions (.github/workflows/test.yml), and build/publish a release artifact on every v*.*.* tag (.github/workflows/release.yml). See each package’s own workflow files for the exact matrix.