lphp

Documentation

Start with the section that matches what you are doing. If a word is new to you, look it up in the glossary at the bottom of this page.

Everything here describes version 2.1.2. What is public, and how stable it is, is listed in STABILITY.md.

New to the framework

  1. Getting started. Build a small module from nothing, one step at a time: a page, a JSON endpoint, a console command, a database table and a test. About half an hour.
  2. What is not built. Things the framework leaves out on purpose, so you do not spend time looking for them.

Guides

Each guide walks through one task in your own application.

Reference

How each part of the framework works, one page per part. Read a page here when a guide links to it, or when you need the details.

Area Pages
Structure Modules · Hooks and filters · Project layout
HTTP Routing · REST · OpenAPI · Errors · HTTP client
Output Templates · Assets · Localization
Data Models · Schemas · Repositories and queries · The database · Storage
Runtime Configuration · Default settings · Cache · Feature flags · Logging · CLI
Background Queue and worker · Scheduler · Mail
Security Security · Sessions · Authentication and authorization · IP addresses
Operations Performance · Observability · System operations · MCP

Running an application

Working on the framework itself

Also in the project root: CHANGELOG.md, what changed in each version, and UPGRADING.md, what to change in your application when you upgrade.

Glossary

The words these pages use, in plain terms, each linked to where it is explained in full.

Word Meaning
Module A folder under modules/ holding one part of your application: its pages, commands, tables and jobs. modules/Shared/ is the one every application has, loaded first; every other folder with a module.php is a module named after the folder, whatever you call it. See Modules.
module.php The one file that tells the framework what a module adds: its routes, commands, services, hooks and settings. See Modules.
Module id A module’s name, taken from where its folder is: modules/Notes/ is Notes.
Route A rule that connects a URL and an HTTP method, such as GET /notes, to the code that answers it. See Routing.
Handler The class or method a route calls. It receives the request, and returns a response, a string (HTML) or an array (JSON). See Routing.
Request, Response The framework’s objects for what the browser sent and what goes back to it.
Template A file that produces HTML, written in Twig (.twig) or PHP (.php). The site’s templates live in templates/, and a module’s in its Templates/ folder. See Templates.
Twig The default template language. It escapes everything it prints, so text from a user cannot become HTML.
Layout The template that holds what every page shares, such as the header and footer. templates/layout.twig is the default one.
Asset A static file for the browser: a stylesheet, script or image. You link to one with asset(). See Assets.
Service An object your code needs, such as a repository. A module registers its services in module.php.
Container The part of the framework that builds services and hands them to the classes that ask for them in their constructors. That handing-over is called injection.
Model A class for one thing your application knows about, such as a note or an invoice, with the rules that keep it valid. It does not save itself. See Models.
Repository The class that reads models from storage and saves them. You name its methods after what your application does, such as latest(). See Repositories and queries.
Migration A file that creates or changes a database table. php laika migrate runs the ones that have not run yet. See The database.
Command Something you run in a terminal, such as php laika migrate. A module can add its own. See CLI.
Hook A named moment, such as note.added, that one module announces and other modules can react to. See Hooks and filters.
Filter A named value that other modules may change before it is used, such as a page title. See Hooks and filters.
Configuration Settings: the framework’s defaults, then a module’s defaults, then your files in config/, with environment variables where a file reads them. See Configuration.
.env An optional file of environment variables for your own machine, such as a database password. It is never committed to git. See Configuration.
Job, queue, worker A job is work to do later, such as sending an email. It waits in a queue until a worker process runs it. See Queue and worker.
Debug mode APP_DEBUG=true: errors show full details. Only for your own machine, never for a live site.