What can Lapis do?
Morzsa Bakery is made up: every name, address and review is invented. The site is also the demo of Lapis. Every row is a feature: where to see it, which file does it, and what to try. Sign in to edit: /_lapis/login. Change anything you like: the demo starts over regularly (the footer says when), and everyone is signed out then.
Getting started
| Feature | Where | Try it |
|---|---|---|
| A new site in one command | composer create-project lapis/app my-site | An empty but working starter site (layout, home page, [slug], 404, config); it runs ./lapis setup at the end. This demo started from it. |
Routing
| Feature | Where | Try it |
|---|---|---|
| A static page /privacy |
pages/privacy.php | The file is the route. Its page record is created on the first edit. |
| A dynamic page with a page record /journal/our-starter-turns-six |
pages/journal/[slug].php | It matches existing records only: try /journal/no-such-post (404). |
| A catch-all, any depth /guides/sourdough/feeding-at-home |
pages/guides/[...path].php | Breadcrumbs from the path, the child pages below. |
| A page type's template /christmas-beigli |
pages/_types/landing.php | A new page of the "Campaign page" type gets this template at any path. |
| A general page | pages/[slug].php | Pages → New page → e.g. "our-flour": an editable page right away. |
| Your own 404 /no-such-page |
pages/_404.php | Its text is a global block, editable. |
| The route list | ./lapis routes | With methods, route files, loader pages and plugin pages. |
Editing on the page
| Feature | Where | Try it |
|---|---|---|
| Text, formatted text, image, link / |
pages/index.php | Sign in and click any heading or paragraph. Ctrl+S saves, Ctrl+Shift+S publishes. |
| Global blocks / |
components/x-layout.view.php | The "Pre-order" button in the header and the footer note are the same on every page. |
| Repeatable lists /#prices |
pages/index.php (<x-repeat>) | The prices and "What we bake": add, reorder, duplicate items. |
| Drafts and publishing | toolbar → Drafts | A change is only yours first; publish it page by page or all at once. |
| History | "History" while editing | Restore an earlier version as a draft. |
| Scheduling and preview links | Drafts → Schedule…, Page → Preview link | The link shows the drafts without signing in, for 3 days. |
| Nothing gets lost | switch the network off while typing | The editor keeps the text and saves it when you are back. |
| On phones too | open it on a phone, signed in | The toolbar and the format bar work on touch screens. |
Images and media
| Feature | Where | Try it |
|---|---|---|
| The place sets the size /#about |
pages/index.php (size="440x528") | Upload a big photo in place of the workshop image: 1x/2x WebP variants, cropped around the focus point. |
| Named sizes /journal/our-starter-turns-six |
lapis.config.php → imageSizes | The cover image is "cover", product images are "card". |
| Media library | toolbar → Media library | Search, alt text, focus point, "where it is used", replace, PDFs too. |
Your own data
| Feature | Where | Try it |
|---|---|---|
| A data table (B) /products |
data/products.php | Toolbar → Data: a new product, order, search; the table is created by itself. |
| A page per record, with a loader /products/rye-loaf |
pages/products/[slug].php | #[Get] loader, #[Cached(tables:)], #[Paths] for the sitemap. Missing: 404. |
| Filtering and live search (htmx) /products?category=pastry |
pages/products/index.php | Type in the search field: the list updates without reloading the page. |
| Data on the home page / |
pages/index.php ($cms->data(…)) | "On the counter today" follows Settings → Featured category. |
| A schemaless collection (C) /faq |
data/faq.php (documents: true) | A new field needs no migration. FAQPage JSON-LD for search engines; the featured ones on the home page. |
| A Tempest model and migration (A) /newsletter |
app/Models/Subscriber.php, app/Migrations/ | The migration runs on boot; the model stores the newsletter subscribers. |
| Demo content | ./lapis demo:seed | The site's own console command, from the app/Console folder. |
Forms and page functions
| Feature | Where | Try it |
|---|---|---|
| Form builder /#preorder |
forms/preorder.php | Works without JavaScript too; the submissions: toolbar → Submissions. The campaign page uses it as well. |
| Every field type /feedback |
forms/feedback.php | Radio buttons, select, number, date, URL, checkbox, groups. |
| Your own #[Post] function with validation /newsletter |
pages/newsletter.php | Send it empty: 422, a message per field, the typed data stays. |
| Rate limit /newsletter |
#[Middleware(new RateLimit(…))] | The 6th quick submission gets 429. |
Route files, API, webhook
| Feature | Where | Try it |
|---|---|---|
| RSS feed /feed.xml |
pages/feed.xml.php | A route file without a template, from the journal posts. |
| JSON API /api/products |
pages/api/products.php | GET for anyone; POST only with an API key (DEMO_API_KEY in .env). |
| The QUERY method | #[Query]: curl -X QUERY /api/products -H 'Content-Type: application/json' -d '{"max_price":1000}' | Filters in the request body; read-only, so no cross-site check and no page cache. |
| CORS for another site | pages/api/_middleware.php (new Cors(…)) | The made-up web shop (https://shop.morzsa.example and its subdomains) may call the API with fetch(); Cors answers the OPTIONS preflight. |
| A signed webhook | pages/webhook/courier.php | #[CrossSite] + Webhook::verify(); without a signature: 403. |
Middleware
| Feature | Where | Try it |
|---|---|---|
| A password-protected area /wholesale |
pages/wholesale/_middleware.php | partner / sourdough (or DEMO_PARTNER_PASSWORD). Editors get in without it. |
| An exception to inheritance /wholesale/how-it-works |
'how-it-works' => new Skip(BasicAuth::class) | This page shows without the password. |
| Headers, a closure, a page cache rule /faq |
pages/_middleware.php | Permissions-Policy and an X-Demo header everywhere, a 5-minute cache for the FAQ. |
| Maintenance | ./lapis down --message="…" | Visitors see pages/_maintenance.php, editors keep working. End: ./lapis up |
Plugin
| Feature | Where | Try it |
|---|---|---|
| A plugin: opening hours /opening-hours |
composer.json → lapis/opening-hours | Its own block type, setting, toolbar panel and data table (Closed days), with schema.org opening hours on every page. |
| Using a plugin on a page /opening-hours |
pages/opening-hours.php | The site's page places the plugin's block and setting, and lists the upcoming closed days from its table. |
Settings, menu, look
| Feature | Where | Try it |
|---|---|---|
| Global settings | lapis.config.php → settings (new Text(…), new Color(…), new Rows(…)) | Toolbar → Settings: phone, accent color, social links, featured category. |
| A menu from the pages | $cms->menu() in the layout | Page panel → "Show in the menu"; while none is marked, the Main menu setting shows. |
| Your own components /journal |
components/x-post-card.view.php, x-product-list, x-loaf | They read their attributes from $attributes. |
| Translations | packages/cms/lang/hu.php | Lapis writes in English and ships a Hungarian translation; with locale: 'hu' the editor speaks Hungarian. A site's lang/{locale}.php can override it. |
SEO
| Feature | Where | Try it |
|---|---|---|
| Search engines and sharing | Page panel → Search engines and sharing | SEO title, description, canonical, noindex, a Google preview. |
| Sitemap and robots /sitemap.xml |
automatic | The product pages from #[Paths]; password-protected pages are left out. |
| Redirects and the 404 log | toolbar → SEO | Rename a page, and the old address answers 301 to the new one. |
| Automatic sharing image | lapis.config.php → ogImage | When a page has no image of its own: see og:image in the source of a post. |
| Structured data / |
lapis.config.php → schema: new SchemaOrg(type: 'Bakery') | Bakery on the home page, BlogPosting in the journal, FAQPage on the FAQ, opening hours from the plugin. |
| Checks | toolbar → SEO → This page | Title and description length, h1, heading order, alt texts, JSON-LD. |
Team
| Feature | Where | Try it |
|---|---|---|
| Roles /_lapis/login |
[email protected] / editor-demo-123 | An editor manages the content; Settings, Users, redirects and the Log are for admins only. |
| Users | toolbar → Users (admin) | A new account with a password or an e-mail invitation, a role, disabling. The last admin cannot be removed. |
| Log | toolbar → Log (admin) | Who published, changed or deleted what; filter by type and person. |
| A page for admins only | new RequireRole(Role::Admin) | As middleware for a folder or a page function. |
| From the console | ./lapis user:create --role=editor, user:role, user:disable | Manage users on the server. |
Running it
| Feature | Where | Try it |
|---|---|---|
| Backup and restore | ./lapis backup, ./lapis backup:restore | The database and the uploads in one file; a daily backup with cron. |
| Checks before going live | ./lapis doctor, ./lapis deploy | PHP extensions, memory for images, HTTPS, e-mail, backups. |
| Forgotten password /_lapis/login |
.env → MAIL_SMTP_* | The link shows only with mail set up. |
| A demo that starts over | ./lapis demo:snapshot, demo:reset (app/Console/DemoReset.php) | A #[Schedule(Every::QUARTER)] command restores the clean snapshot every DEMO_RESET_MINUTES; cron runs ./lapis schedule:run. |