Laika Framework Documentation
Laika is a lightweight Moduler First MVC framework for PHP 8.1+. Requests flow through pipelines (middleware before the controller), the controller, and filters (middleware after it), backed by a query builder, Twig templates, a service container and a code-generating CLI. Everything ships as small Composer packages under vendor/laikait/.
New to Laika? Read Getting Started in order. Looking for something specific? Try the common tasks table.
Getting Started
The Basics
| Guide |
Covers |
| Routing |
Routes, parameters, named routes, groups, fallbacks |
| Controllers |
Return values, parameters, dependency injection |
| Requests |
Input, files, headers, validation |
| Responses |
JSON, status codes, redirects, flash messages, cookies, downloads |
| Pipelines |
Middleware that runs before the controller |
| Filters |
Middleware that runs after the controller |
| Templates |
Twig views, template variables, filters |
| Assets, Meta & Navigation |
Styles, scripts, meta tags, context, menus, icons |
Database
Architecture
| Guide |
Covers |
| Services & Relays |
The container, providers, relays, auto-wiring |
| Relay List |
Every Laika\Engine\Services\* relay |
| Hooks |
lf-hooks/, add_hook() / do_hook() / apply_hook() |
| Resources |
How classes are discovered; adding your own resource types |
| Helper Functions |
Every global helper function |
Security
Beyond the Request
| Guide |
Covers |
| Sessions |
File, database, Redis and Memcached sessions |
| Session Drivers & Operations |
Locking, garbage collection, failure modes, several servers |
| Queue |
Background jobs and the worker |
| Queue Drivers & Operations |
Driver internals, stuck jobs, worker hooks, custom drivers |
| Caching |
File, Redis and Memcached caches; query, response and template caching |
| Mail |
Sending and reading email |
| Files & Storage |
Uploads, images, files, local and S3 storage |
| Errors & Logging |
The error handler, HTTP exceptions, logs, activity log, options |
| Utilities |
Dates, precise math, cron, shell commands, IP maths |
| Extending the Framework |
Custom drivers, macros and subclassing framework classes |
Operations
| Guide |
Covers |
| Deployment |
Apache, nginx, PHP-FPM, production checklist, running the worker |
Common Tasks
Package Reference
The whole framework ships in one package, laikait/laika-engine. These docs explain how its modules fit together inside an application; the engine’s docs/<module>/ folders go deeper into their internals:
| Module |
Namespace |
Provides |
| Core |
Laika\Engine\* (App, Http, Helper, Support, …) |
Bootstrap, request/response, validation, templates, helpers, storage, security, errors |
| Route |
Laika\Engine\Route |
Router, dispatcher, pipelines and filters |
| Model |
Laika\Engine\Model |
PDO query builder, schema builder, backup, SQL converter |
| Relay |
Laika\Engine\Relay, Laika\Engine\Services |
Service container, relay base class and the core service relays |
| Session |
Laika\Engine\Session |
File, database, Redis and Memcached session handlers |
| Auth |
Laika\Engine\Auth |
Session, cookie and token guards |
| Shield |
Laika\Engine\Shield |
Firewall pipeline (rate limiting, IP/country blocking, SQLi/XSS detection) |
| Queue |
Laika\Engine\Queue |
Background job queue and worker |
| Cache |
Laika\Engine\Cache |
Cache drivers: file, array, Redis, Memcached |
| Mailman |
Laika\Engine\Mailman |
Mail sending (PHPMailer) and IMAP/POP3 reading |
| Cli |
Laika\Engine\Cli |
The laika command-line tool |
Where a package README and these docs disagree about behaviour inside a Laika app, these docs describe the current code.
Getting Help