# Lapis

> Lapis is a PHP CMS with file-based routing and in-place editing, built on Tempest.

A Lapis site is a Composer project: `pages/` are the routes (Next.js style), `components/` are Tempest view components, editors change `<x-block>`s on the page itself. In a site, the same files are in `vendor/lapis/cms/docs/`, matching the installed version, and `./lapis` lists the console commands.

The whole documentation in one file: [https://lapis-cms.dev/llms-full.txt](https://lapis-cms.dev/llms-full.txt)

## Getting started

- [Introduction](https://lapis-cms.dev/docs/introduction.md): Lapis is a PHP CMS with file-based routing and in-place editing, built on Tempest. Editors change the content on the page itself, developers write plain templates.
- [Installation](https://lapis-cms.dev/docs/installation.md): Create a new Lapis site from the starter, or add Lapis to an existing Composer project. Either way, one setup command prepares the site.

## Building a site

- [Routing](https://lapis-cms.dev/docs/routing.md): The files in pages/ are the routes. A file's path is its URL, brackets make parameters, and page types choose the template of a page.
- [Templates](https://lapis-cms.dev/docs/templates.md): Page files are Tempest views. Every template gets the page, the site's settings and the Lapis helpers, and a setup block at the top prepares its data.
- [Editable content](https://lapis-cms.dev/docs/blocks.md): Everything an editor changes on a page is a block. Blocks are written into templates with <x-block>, saved as drafts, published and kept in a history.
- [Images and media](https://lapis-cms.dev/docs/images.md): Images are uploaded once and shown everywhere in the size the place needs, with retina variants, WebP and a focus point. The media library keeps every file.
- [Global settings](https://lapis-cms.dev/docs/settings.md): Global settings are the values that are the same on every page, such as the site's name or the menu. They are declared in lapis.config.php and edited in the toolbar.
- [Assets and import map](https://lapis-cms.dev/docs/assets.md): JavaScript and CSS reach the browser through an import map, without Node and without a build step. Every file gets a versioned URL.
- [SEO](https://lapis-cms.dev/docs/seo.md): Lapis writes what search engines and social sites read, from the page's own data and the settings. Editors fill in the rest in the Page panel.

## Data and code

- [Data tables](https://lapis-cms.dev/docs/data.md): A data table is a file in data/ that returns a Table. Lapis creates and migrates the database table, gives you a query builder and gives editors a panel for the records.
- [Forms](https://lapis-cms.dev/docs/forms.md): A form is a file in forms/ that returns a Form. Lapis renders it, validates it, keeps spam out, stores the submissions and tells you about them.
- [Page functions](https://lapis-cms.dev/docs/page-functions.md): A page file can handle more than GET. Attributed functions in its setup block load the template's data, answer forms and serve JSON, with validation and protection built in.
- [Middleware](https://lapis-cms.dev/docs/middleware.md): A _middleware.php in a folder of pages/ applies to every URL below it. Use it for passwords, cache rules, headers, rate limits and CORS.

## Extending

- [Plugins](https://lapis-cms.dev/docs/plugins.md): A plugin is a Composer package with a Plugin class. It adds settings, block types, panels, tables, pages, middleware and translations, listens to events and may bring its own editor module.

## Running a site

- [The editor and users](https://lapis-cms.dev/docs/editor.md): Editors work in a floating toolbar on the page itself. Accounts are admins or editors, and an audit log records who changed what.
- [Console](https://lapis-cms.dev/docs/console.md): ./lapis is the console of a Lapis site. It sets the site up, manages users, assets, backups and data, deploys, and installs the skill for coding agents.
- [E-mail](https://lapis-cms.dev/docs/email.md): With mail configured in .env, Lapis sends password resets, invitations and form notifications. Without it, these features stay off.
- [Deploying](https://lapis-cms.dev/docs/deploy.md): What a production server needs, how to install and update a Lapis site, how to set up nginx or Apache, and how to keep backups.
- [Security](https://lapis-cms.dev/docs/security.md): How Lapis protects sign-ins, the editor API and its pages, and where to read more before going live.
- [Testing](https://lapis-cms.dev/docs/testing.md): Test your site with LapisTestCase on temporary storage, and run Lapis's own unit, integration and browser tests inside the package.

## Optional

- [Tempest workarounds](https://lapis-cms.dev/docs/tempest-workarounds.md): The places where Lapis works around Tempest's behavior, each with the test that fails first when a Tempest update changes it.
- [API review (v1.0)](https://lapis-cms.dev/docs/api-review.md): What a site, a plugin or a test touches, and what was changed before version 1.0 froze it.
- [Releasing](https://lapis-cms.dev/docs/releasing.md): Repositories, versioning, the release workflow and database schema changes.
