Download the PHP package preflow/folio without Composer

On this page you can find all versions of the php package preflow/folio. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package folio

preflow/folio

Folio is the admin for Preflow sites. Require it into any Preflow app and you get an admin (mounted at a configurable path) to edit and publish the site's models and pages, a media library, and rendering of the pages it manages — without touching the framework.

Installation

Requires PHP 8.4+. Composes preflow/data, preflow/view, preflow/routing, and preflow/form (all already present in a standard Preflow app).

Ready-wired app: composer create-project preflow/starter-folio myapp gives you a seeded job board with Folio already configured. The steps below are for adding Folio to an existing app. If Composer refuses a dev version, allow it in your composer.json ("minimum-stability": "dev", "prefer-stable": true) or require it explicitly with composer require preflow/folio:@dev.

Getting started

Folio is opt-in: a plain Preflow app (preflow/starter) does not wire it for you; preflow/starter-folio does. Three small steps.

1. Register the service provider

In config/providers.php:

2. Choose the admin mount path (optional)

The admin mounts at /folio by default. To change it, add config/folio.php:

Cache files: Folio keeps folio-extensions.cache and folio-translations-{locale}.php in storage/cache. config/folio.php 'cache_path' moves them (preflow/blocks' blocks.cache follows config/blocks.php 'cache_path', default storage/cache): an absolute path is used as it is, a relative one is taken from the project root. Folio creates the directory when it writes. Core's own caches (storage/cache/data, compiled templates) are not affected. A test suite can point cache_path at a temp directory, so booting the app never writes into the project's cache:

The admin login uses the session from config/auth.php. By default core starts it on every request, so public pages get a session cookie too. To keep public pages cookie-free, limit the session to the admin path:

Requests outside those prefixes get no session, but they are still checked for CSRF: csrf_field() prints a stateless token there (with a real app.key; see the CSRF section of preflow/core).

The staff login ({path}/login, from config/folio.php path) is a CSRF sign-in path: a login form left open until the session expired still signs in when the browser's origin check passes (the password is the proof), instead of failing with a 403. Other admin forms whose session expired are sent back with a warning and their fields kept, never applied.

3. Define a content type

Content types are JSON files in config/models/ (the existing data.models_path). Create config/models/page.json:

That's it. Start the app and visit /folio — a Pages area appears with create / edit / delete. Pages with status: published render on the public frontend at their slug (e.g. /about), resolved by a lowest-priority catch-all so your own routes always win.

storage: "json" writes one flat file per record under storage/data/page/ — zero config, no migration. Switch a type to a database by changing storage to a configured driver (e.g. sqlite); the admin and rendering are storage-agnostic.

How it fits together

Concern Owner
Type definition (page.json) preflow/data (TypeRegistry, DynamicRecord)
Record CRUD + validation preflow/data (DataManager::*Type())
Auto-form from the type preflow/form
Shipped admin (dashboard, CRUD), routing, slug rendering preflow/folio

Admin and frontend templates live under @folio/* and are overridable: drop a same-named template in resources/folio/ to replace the shipped one.

Template engines. Folio's own templates are Twig: the admin, its fallback frontend templates (@folio/frontend/page.twig, @folio/frontend/{type}.twig), extensions' @{name}/… templates and their overrides in resources/folio/. They render through a Twig engine Folio owns, whatever config/app.php engine is (Twig, Blade or a TemplateEngineFactory): every template name ending in .twig goes there. Any other name is an app template, such as a type's frontend.template written for the app's engine ("template": "pages/job.phtml"), and renders through the app's engine, where the folio_* functions (folio_get, folio_list, folio_find, folio_alternate_links, …) are registered too. Folio's Twig engine is built like the app's (core's TemplateEngineContext; compiled templates under the app engine's cache folder, …/folio-twig) and gets every function and global of the app's engine (SharingTemplateEngine), so csrf_field(), t(), hd work in Folio's templates as before. On a Twig app both are the app's engine: nothing changes there. Preflow\Folio\View\FolioEngine (a container service) is the engine Folio renders with; a package that renders Folio's or its own Folio extension's Twig templates uses it (preflow/rbac does). Block components and other components render through the app's engine, as everywhere else.

The admin ships its own htmx (@folio/htmx.js) whatever the app's hypermedia driver (config/app.php hypermedia) is: its screens never use the app's driver, and Folio adds htmx to core's HypermediaProtocols, so its requests are treated as htmx requests (an expired session reloads the editor, a signed-out one is sent to the login) next to the app's own driver.

Access

Every admin action asks one permission through can() (see preflow/auth).

Content types have {type}.view, create, edit, publish and delete.

Assets have assets.view, upload, edit and delete.

The dashboard needs folio.dashboard. Without it, login lands on the first section the user may view.

The Translations screen needs translations.edit (an admin role with * has it). Choosing one's own admin language needs no permission.

Settings → Redirects needs redirects.manage. The automatic redirects need no permission, and choosing where a deleted or unpublished page's old links go needs only the right to that delete or unpublish (see Redirects).

Block editor fragments need edit on any type.

New permissions. A permission that arrives with an update is never given to a role by Folio. Folio keeps the list of permissions this site has seen (Preflow\Folio\Permissions\KnownPermissions, table folio_known_permissions, since 0.53; created by preflow migrate or folio:extensions:apply on SQL storage, JSON storage needs neither). The first time it is read, every enabled permission becomes known silently, except redirects.manage: it came with 0.52, shortly before the list (0.53), and roles with an explicit permission list never received it. After that, each new one counts as new until someone dismisses it or adds it to a role. A permission of a switched-off extension is new only once the extension is switched on. With preflow/rbac, preflow migrate prints the new ones ("New permissions to review in Settings → Roles: …") without marking them known; without it, it prints nothing. With preflow/rbac the notice, the sidebar count and the dashboard line are shown to whoever may edit roles; see rbac. Before preflow migrate has run, they show nothing.

The sidebar, dashboard cards, list buttons and form buttons follow the same answers. A form the user may not save is shown read-only. Each check is also enforced on the server, so a hidden button is never the only protection. A refused htmx request (autosave, block picker) shows its message as a toast.

Defaults. Without a permission package, every signed-in staff user may do everything, as before. For roles from a config file, add preflow/roles; for roles and permissions edited in Folio itself, add preflow/rbac:

The own account page ({prefix}/_account) asks no permission (FolioPermissionMiddleware::SIGNED_IN): every signed-in record user may open it, an account without roles too. Any other admin handler without a rule is refused (fail closed).

Staff login

Who may sign in. Only staff: Folio signs them in through one guard of config/auth.php, named by config/folio.php 'guard' (default: the app's default guard, as before 0.65). Its population must be staff:

Upgrading an app made from preflow/starter before 0.65 that added Folio: its config/auth.php is its own copy, and its employers guard has no population. Folio then still takes that guard as staff, and every employer keeps full admin access. Add 'population' => 'employers' to the employers guard yourself; Folio then refuses to boot until you set up a staff guard as above.

A guard that config/auth.php does not define stops the boot too. Preflow\Folio\Users\StaffUsers (a container service) gives packages the staff guard's name (guard()) and user provider (provider(), null without auth); preflow/rbac's config-user check and staff:import-config read it, so they follow 'guard' too. Folio marks its guard as staff (Access::markStaffGuard()); preflow/members' Viewer::isStaff() counts a user of any staff guard, so it agrees with guard. A user signed in on another guard on the same request (an employer, a member) is sent to the admin login.

The login page has the same options for every site:

The rest applies only when the staff guard has record users: a RecordUserProvider, directly or in a ChainUserProvider. A site whose staff are config users only keeps its login exactly as before: the same page, no throttle, no forgot link, and no new routes.

Preflow\Folio\Users\StaffPasswords (a container service) is the API for packages that manage the accounts (preflow/rbac). It works for any record user type of the staff guard:

Records are saved without hooks or revisions.

Revision authors. Revisions store who saved them: the e-mail for a config user, the id for any other. Preflow\Folio\Users\AuthorNames shows an id as the account's name (else its e-mail), a disabled account included: a record user's from its record, any other user from the staff guard's provider (findById(); its name/email, as public properties or getName()/getEmail(), so a model behind DataManagerUserProvider shows by name too). It shows an e-mail or an unknown value as stored (older rows hold names); person(), which the activity log uses, shows an unknown id as "Former user" (folio.activity.former_user).

Recent changes and All activity (0.77)

The dashboard's Recent changes shows the 5 newest rows of the core's activity log (core README, "Activity log"), loaded just after the page (?part=recent, like "Needs you"), beside the content from 1280px. All activity ({prefix}/activity) has the rest: 50 rows a page ("Older" follows the log's cursor, "Newest" goes back), with filters for the type and the person. A row shows the type tile, the title linking to the record (a deleted record shows its stored title without a link), what happened ("Post · Title, Body edited · draft saved": up to two changed fields by their labels), who (AuthorNames) and when ("5 minutes ago", "Yesterday", then the date).

Rows are filtered on the server: a type's rows for {type}.view, assets for assets.view, redirects for redirects.manage; nothing else is read. An app's own subject (invoice, recorded by its own code) shows for whoever holds its declared invoice.view permission, without a link. Its name in the rows and the type filter is the phrase folio.activity.subjects.invoice, which the site gives in its own lang/{locale}/folio.php (['activity' => ['subjects' => ['invoice' => 'Bill']]]), else its readable name ("work_order": "Work order"; since 0.77). asset, redirect and activity are reserved: no type may take them as its key (a boot error), and a declared redirect.view grants nothing. The screen asks folio.dashboard, as the dashboard does; there is no permission of its own. Preflow\Folio\Dashboard\RecentChanges builds the rows for both.

Overriding the dashboard

The dashboard is the one core admin action an app can replace without forking: a class App\Folio\Overrides\Content\Index implementing OverridableAction is shown instead of Folio's dashboard (the list, form and other screens look for no override; change those with type customizations and screens, see Extensions):

Admin styling

The admin ships a single stylesheet served by Folio itself at {prefix}/_assets/admin.css (no build step, no asset publishing required). The <link> URL is content-hash versioned via the folio_admin_css_url Twig global, so it caches immutably and busts on change.

Inter and JetBrains Mono are self-hosted (since 0.75): Folio serves the font files from {prefix}/_assets/ and loads them with @font-face in admin.css. Nothing is fetched from a font CDN, and a strict font-src 'self' policy is enough. Both fonts are under the SIL Open Font License 1.1, and the licence texts ship beside them in assets/fonts/.

Dark mode is built in. Every colour is one token in the :root block, written as light-dark(light, dark), with an emerald accent and the sign-in's green-black "ink" (since 0.73). The default follows the operating system (prefers-color-scheme). The Theme row in the user menu (the button at the foot of the sidebar) lets the user override it, persisted in localStorage and applied by a no-flash inline script. Extension CSS should read the tokens (var(--c-surface), var(--c-text-muted), var(--c-accent) and so on) instead of colour literals, so it follows both themes.

Notices and alerts:

Markup Tone
<div class="folio-notice" role="status"> Info (blue), the default since 0.73: something to know.
<div class="folio-notice is-warning" role="status">, or <div class="folio-notice" role="alert"> Warning (amber): something that needs attention. role="alert" also makes screen readers announce it at once, so use it only for what has just gone wrong.
<div class="folio-alert folio-alert-error" role="alert"> Error (red): something failed.
<div class="folio-alert folio-alert-success" role="status"> Done (emerald).

Before 0.73 every .folio-notice was amber. A notice that should still look like a warning needs is-warning.

Extension templates that extend @folio/admin/_layout.twig can use:

Every template is overridable via the @folio namespace (drop replacements in resources/folio/). Because the admin renders through action-mode controllers, the stylesheet link and the small theme scripts are plain markup in _layout.twig rather than going through the asset collector. They already carry nonce="{{ csp_nonce() }}", so the admin works under Preflow's default strict CSP. If you override _layout.twig, keep the nonces and the <meta name="csp-nonce"> tag (the rich-text editor reads it).

Type tiles and families

Since 0.75 each type and block has a tile: its icon on the tint of its family, a Preflow\Data\TypeFamily (see the preflow/data README). A type declares it at the top of its model file (for a model class, in its admin file):

"family" For Tint
page pages and posts (the default for a type with a "frontend") --c-type-page (blue)
reference lookup data: categories, companies, tags --c-type-reference (violet)
asset files and media --c-type-asset (amber)
member accounts (the default for a user type) --c-type-member (lime)
shop products, orders --c-type-shop (rose)
live tools that act at once: jobs, a queue the accent (emerald)

Without a "family" (and without a frontend or users) the tile is neutral. Any other value stops the boot with Type "company": "family" must be one of page, reference, asset, member, shop, live. A block takes it from its attribute, #[Block('quote', family: TypeFamily::Reference)] (preflow/blocks), and an extension's sidebar item from AdminNav::add(…, family: TypeFamily::Live).

The tiles show in list headers and rows, the dashboard's review queue, block cards, the block picker and relation rows; the sidebar's items (folio_nav()) carry the family too, for a layout of your own. Each tint is a token pair in admin.css, --c-type-{family} and --c-type-{family}-soft, written as light-dark() like every colour; .folio-type-icon[data-family] is the only rule that maps a family to them, so no template names a colour. live uses the emerald accent, which also marks actions (the primary button, focus, ticked rows): a live tile reads as "acts at once". In your own templates, draw a tile with the macro:

The ink layer (since 0.76)

Folio's darkest surface, the sign-in's green-black with its glow, is the ink layer: the dashboard band, the brand tile, empty states and the 404 / forbidden cards. It looks the same in both themes. Use it sparingly: at most one ink place per screen, never inside a form or a table. The classes, for a screen of your own:

Class What
.folio-ink the surface: ink background with its glow, light text, rounded
.folio-ink-card a card on it: text at the bottom left, marks behind it on the right
.folio-ink-title the card's title
.folio-ink-line the living line: mono text in ink's light green; end it with <span class="folio-caret" aria-hidden="true"></span>
.folio-ink-action (on a .btn) the primary action on ink (--ink-accent)
.folio-ink-error, .folio-ink-glyph, .folio-ink-muted the 404 / forbidden card: one large mark glyph, a muted message
.folio-ink-marks the marks layer (folio_ink_marks() draws it)
.folio-ink-drift the marks drift slowly (stopped under reduced motion)
.mc-1 … .mc-6 the six mark hues (--mark-1 … --mark-6)

folio_ink_marks(seed, count = 6, area = {}, aspect = 1) draws the editing marks (caret, pilcrow, brace, …: the mark-* symbols of icons.svg) as one aria-hidden <svg>, placed from a fixed seed so a screen looks the same on every request. A seed that is not a number is a screen's fixed name (its crc32 is the seed). area is the box the marks stay in, as fractions of the surface ({x: [0.5, 1.0], y: [0, 1]}: the right half, away from the text); aspect is the surface's width / height, so the marks spread evenly on screen; count is at most 60. In PHP, Preflow\Folio\View\InkMarks::place() gives the same placement as data.

An empty list of your own can use the partial instead: {% include '@folio/admin/partials/_empty.twig' with {screen: 'shop', title: '…', line: '…', action: {label: '…', url: '…'}} only %}.

Styling extension screens

Screens inside the admin shell get the control styling for free: plain input, select, textarea and button elements already look like Folio's. Three reusable pieces cover the common layouts:

Model classes as types

A PHP model marked #[Entity(type: 'job')] (see preflow/data, "Model classes as types") is the type job. Folio edits it like a JSON type: lists, search, filters, forms, drafts, publishing, version-checked saves, relations, media, translations and page cache tracking, from the one class definition.

A class appears in Folio only when config/models/job.json exists. That admin-only file holds presentation: label, icon, section, list columns, filters, sort, publishing, and per field readonly, hidden, placeholder, and so on. It may not set schema (table, storage, id_field, matrixable, views, or a field's type, validate, translatable, unique, index, length, searchable, transform, default, relation, options, accept, time, blocks, fields, multiple): such a file is refused with an error naming it. A class without the file is never listed, and "extends": true patch files do not apply to class keys. Folio creates the tables (job, job__published, job__revisions) as for any type.

App code reads and writes the working copy through the DataManager (find, query, save). A save that changes a published record shows it as "Changed", like an edit in the admin. To read what is published, as public pages do, use PublishedModels:

The objects are read-only; saving one throws. In an admin or share preview it returns the working copy, as LiveContent does for JSON types; so it does for a type with publishing off (it has no published copies: the record is what the site shows). It refuses a class that is not a registered type.

Type options

Besides fields, a type JSON can carry two optional blocks, plus the flags singleton and publishing (see below) and its sidebar place.

A type's key cannot be a path Folio uses under its prefix (login, logout, _assets, _uploads, _blocks, media, extensions, blocks, preview, upload, assets); such a key is an error naming the type.

frontend: public rendering

The gate needs the signed-in user. With session.paths (config/auth.php), a session starts on those paths and resumes elsewhere only when the visitor brings its cookie: include the route's prefix there (/tools, and /de/tools for prefixed locales) so a member who signs in there has a session for it. The session cookie's path (session.path) must cover the prefix as well. Access is granted when any signed-in user, staff or member guard, has the permission. A share-preview link does not open the gate: it stays a staff tool, and the reviewer must pass the gate as well. The admin live preview is unaffected. The gate fails closed: without auth configured nobody is signed in, so nobody passes it.

Any template can read other content too:

All three return live content only: published snapshots of publishing types, so drafts never reach the site. In the admin preview they return working copies. Values are localized to the page's locale. App code gets the same lists from Preflow\Folio\Content\Collections.

Rich text arrives sanitized wherever a template reads it: in rendered, in blocks (nested data-only blocks too), and from folio_get, folio_list and folio_find. That holds however the value was stored (admin save, import, app code), so |raw is safe for richtext fields. Other fields stay plain text and are escaped as usual.

Routes are tried most specific first. Two types claiming the same route, or two types declaring home, stop the app at boot with a message naming both. Without any frontend block, a page type is served at /{slug} exactly as before. The live preview is available for every type that has a route.

list: the admin list

Every list has a search box (all words must match, each in any text field or, one level deep, in the label and text fields of a related record; a field with "searchable": false is left out, and so is a hidden field unless it says "searchable": true), sortable headers for the plain columns (not relations), highlighted matches and paging by 50. The view lives in the URL, so it can be bookmarked and shared:

Parameter Meaning
q Search words (at most 200 characters).
f[field] A filter from list.filters: a value, f[field][from] / f[field][to] for dates (YYYY-MM-DD), f[field][] ids for relations.
status A publishing type's state: published, changed (changes not live) or draft (since 0.75). Other types ignore it.
sort A shown column, - prefix for descending.
page 1-based page number, clamped to a sane range.
_partial=1 Only the results region, which the live search swaps in.

Unknown fields, malformed values and out-of-range pages are dropped, never an error.

The list screen (since 0.75). The header shows the type's tile (its family tint and icon) and how many records the type has; lists use the whole content width. The toolbar holds the search, for a publishing type the status links All · Published · Changes not live · Drafts (each counted over the whole type; they keep the search, filters and sort), "+ Filter" (a popover; active filters are chips under the toolbar; its Reset is a link to the view without filters) and a row-height toggle (Compact 44px / Comfortable 60px, kept per browser in localStorage['folio.density']). A frontend type's rows show their tile and their address in the default language (mono); the record its route serves at / (frontend.home) is marked "The home page · slug “home”". Number columns are mono and right-aligned. The language column is the language indicator: every language of the type, complete, partial or missing, with a dot for outdated or not checked translations (those link to ?unchecked=1).

Each row opens its record; everything else is in its "…" menu: Edit, View on site (a live record with an address), Copy preview link, Duplicate, Move up / down (orderable lists) and the type's header record actions (#[RecordAction] without toolbar: false), then after a divider the danger items Unpublish and Delete… (delete plan and "Send its old links to…" as before). Each item shows only for those who may use it. Duplicate posts to {prefix}/{type}/{id}/duplicate (the type's create permission) and opens the copy's editor: a draft whose title (the list's first column) reads “… (copy)” in each language (folio.list.copy_title; a copy of a copy counts on: “(copy 2)”), with a free address (RecordWriter::duplicate(); a site that binds its own RecordTypes should implement RecordAddressFields too, see preflow/publishing). It is never offered, and the route refuses it, for a singleton or a user type (the copy would carry the account's password and sign-in). Copy preview link asks the share route for JSON (Accept: application/json: {url, message, days}) and writes the link to the clipboard. Ticked rows bring up the bulk bar, which floats under the table.

Keyboard shortcuts (? lists them): / search, n new, j / k next and previous row, Enter or e open it, x tick it, . its menu, d duplicate it. They never fire while typing in a text field (a tick box or a button does not count) or with Ctrl, Alt or ⌘ held. An admin script adds its own through Folio.shortcuts.add({key, label, run, mod, typing, quietInMenus}) (mod: ⌘ / Ctrl + key; typing: also inside fields; quietInMenus: do nothing while a row's "…" menu is open, instead of closing it; run returns false when it did nothing).

Overriding @folio/admin/list.twig: the page extends the layout and includes @folio/admin/_list_results.twig for the swappable region. In a row, row.cells[column] is the cell as plain text (escape it) and row.marked[column] is the same text as already escaped HTML with the search matches in <mark> (print it with |raw). Use list.headers for the sort links, list.chips, list.clear, bulk (null without any bulk action: no tick column) and export_url. With the tick column the cell positions shift by one. Since 0.75 a row also carries languages (a list of {code, name, state}, state a LocaleState, for the languages() macro in partials/_languages.twig; before, a list of badges {text, state, href}), home (the home page's meta line or null), address and menu ({view_url, unpublish_url, unpublish_addresses, share_url}); the page has family, glyph, type_total, column_kinds (field => number, relation or text), frontend, may ({create, edit, delete}) and row_menu ({duplicate, actions}). The bulk bar now follows the table (admin.js marks it is-floating; is-overlay, its name before, stays an alias selector in admin.css until 0.76). row.extra holds the cells of extension #[ListColumn]s, in their order after the type's own columns (headings in extra_columns): each is plain text (escape it), a badge {label, tone} or a link {label, href} (see Type customizations). Extension columns are neither in the Excel export nor sortable. A site that overrides _list_results.twig must check cell.href before treating an iterable cell as a badge.

At most 500 rows can be ticked for one bulk action or export (RecordDeleter::MAX_IDS): a request with more ids[] is refused with a 422 and changes nothing.

The relation picker's search endpoint (GET {prefix}/_relation/{type}?q=&label=&order=&meta=&page=) only uses a label / order / meta field that a relation to that type declares as its labelField / orderBy / metaField, and never a hidden field; it pages in the declared order, then by id.

Deleting: onDelete and the summary

A relation field can say what deleting its target does to the records that point at it:

Deleting, single or bulk, goes through a delete plan, record by record on Folio's own save and delete paths (so #[BeforeDelete], #[BeforeSave] and the after hooks run for cascaded and detached records). Before the confirmation the admin asks POST {prefix}/{type}/_delete-plan and shows the summary: "This can't be undone." plus a line per type, such as "Also deletes 3 posts." or "2 posts lose a link."; for a restricted plan it shows the refusal ("Can't delete: 2 posts still point here.") instead. The summary is only information: the delete computes its own plan. If any hook refuses, nothing is deleted. SQL writes run in one transaction per connection; JSON-file writes can't be rolled back. When the records to delete (cascades included) have public addresses, the summary also counts them (addresses) and the admin asks where their old links go (see Redirects).

Bulk actions

The bulk bar appears when a row can be ticked: set fields from list.bulk, extension actions and delete (each only for those who may use it).

#[BulkAction(name, label, permission, confirm: null)] on a #[FolioType] method, signature fn(list<DynamicRecord> $records, ServerRequestInterface $request): ?ResponseInterface. It is posted to {prefix}/{type}/_bulk/{name} with the ticked ids[]. It needs the permission and the type's edit permission; the records are the ticked ones of this type that exist, in the order posted. Returning null redirects back to the same list view with "{label}: done (N)"; a response (a download, say) is sent as is; anything else is an error. The names delete, export and set-… are Folio's own. Bulk delete needs the type's delete permission and is all or nothing.

Excel export

With openspout/openspout (^4) installed (composer require openspout/openspout), lists get an Export button: GET {prefix}/{type}/_export downloads an .xlsx of the whole filtered and sorted list (not just the page), streamed in chunks of 500, or of the ticked rows when ids[] are given. Columns are the list's own; numbers and dates are typed cells, text is never written as a formula. Since 0.75 the export also narrows as the list does: status (a publishing type's state) and unchecked=1 apply to it. Without OpenSpout there is no button and the URL is a 404.

Upgrading to 0.29 — notes for site owners

Sidebar

The sections, in this order: the dashboard, Pages (pages), Content (content), Library (library), Settings (settings). Any other name sits between Content and Library (several, in the order first used), labelled from the name (member_area becomes "Member area"). Sections the user can see nothing in are left out. A wrong type for any of these keys is an error naming the type.

Which sections start closed is set in config/folio.php; everyone can open or close a section, and the sidebar remembers it per person. The section of the current screen is always open, and a closed section shows the sum of its items' badges. This is the default:

A value that is not a list of section names is ignored (every section starts open).

Field types

string, text ("monospace": true gives a code-style editor), number, boolean, date ("time": true for date and time), select ("options" as a map or a list; "display": "radio"), richtext, asset, relation, matrix and tags (since 0.77).

How the editor shows them (since 0.75, the LibFields board; assets/fields.js runs the controls):

An invalid "unit" or "display" (or "display": "cards" without {label, help} options) stops the boot with a FrontendConfigException naming the type and the field.

number takes "step": 0.5 (any positive number) or "step": "any" (since 0.46). The input gets that step, and with a number the server checks that the value is numeric and a multiple of the step (2.3 is refused for 0.5); "any" checks only numeric. Both checks judge a filled value only, so an optional number field can be saved empty; with "validate": ["required"] an empty value gets the required message alone. Without the option the browser takes whole numbers only and the server checks nothing (as before). Any other value is a configuration error, and so is a step with more than 15 significant digits ("0.1234567890123456"): the check gets the step as a float, which holds no more exactly, so it would compare against a different step. Both throw a LogicException. A float step is read at 15 significant digits (0.1 + 0.2 is 0.3).

Any field also takes:

hidden and readonly apply on create too: such a field starts empty unless a #[BeforeSave] hook sets it.

Where the editor puts a field (since 0.75; Folio-only keys, like "hidden"):

Any other value of either key stops the boot with a FrontendConfigException naming the type and the field. The fields the type's frontend address is built from (its route's parameters, such as slug) always sit in the side panel's Address section.

The admin display (read-only fields and list cells) is the field type's renderAdmin() when it implements Preflow\Folio\Field\DisplaysInAdmin, otherwise its frontend output. A custom field type can implement it to show a friendlier value in the admin than it stores. The frontend output is never changed by it.

A date shows in the admin as folio_date() writes it in the interface language: "Oct 22, 2026" (German "22.10.2026", French "22/10/2026"), or "Oct 22, 2026 23:15" with "time": true. Only Y-m-d, Y-m-d\TH:i and ISO 8601 with an offset (shown in the app's timezone) are parsed; any other value is shown escaped as it is stored, never as an error.

A field type says how its value is stored in a SQL column by implementing Preflow\Folio\Field\HasColumnKind (columnKind(array $config): Preflow\Data\Schema\ColumnKind: Text, Short, Number, Boolean or Date); Folio registers it with the data package. The shipped types do (number is a number, boolean yes/no, date an ISO text, string, select, env and a single relation are short when unique or indexed, otherwise text); a type without it is stored as text.

A field type's own rules (e.g. select's allowed values) are enforced in addition to validate. rules() returns rule names or ValidationRule objects; an object needn't be Stringable (since 0.66: Folio keeps each name once and each object once, without casting). To add or replace a type, list the classes in config/folio.php:

From a package (since 0.66). A package adds its field types by being installed: list them in its composer.json, and they are registered like config/folio.php's (built by the container; SearchableText, HasColumnKind and the field kinds apply). Blocks are listed in extra.preflow.blocks (preflow/blocks):

The order is built-ins, then packages' types, then config/folio.php's: a later type with a key already taken replaces the earlier one, so the app's config wins. A listed class that is no field type stops the boot naming the package. A type a provider registers itself later ($container->get(FieldTypeRegistry::class)->register(…) in boot()) gets its field kinds too.

A field type's assets() names the .css and .js files its editor needs; Folio loads them only on forms that render the field, from {prefix}/_assets/{file}. A package serves its own files there by adding them in its provider's boot(): $container->get(Preflow\Folio\Http\AdminAssets::class)->add('color.css', __DIR__ . '/../assets/color.css') (an absolute path; a name already taken is an error).

Blocks

Blocks are their own package, preflow/blocks (Preflow\Blocks, since 0.70): writing a block type, data-only blocks, discovery (app/Components, app/Blocks, extra.preflow.blocks, config/blocks.php) and rendering with blocks() are described there. Folio adds the blocks field type and its editor, and answers the blocks' questions: they render in Folio's content locale (the page's, or the editing locale in a preview), their rich text is sanitized on the way to the template, and in the live preview each block's root element carries data-folio-block="<uid>" and data-folio-label.

On a content type: "sections": {"type": "blocks", "allowed": ["hero", "text"], "min": 1, "max": 10}. The editor saves at most config/blocks.php 'max_depth' levels of blocks in all (default 4).

Storage: an ordered list inside the record, so nothing extra to migrate.

Editing:

Rendering in Folio's templates:

Blocks, matrix or relation?

Singletons

"singleton": true makes a type hold exactly one record, such as site settings:

Drafts and publishing

Publishing is its own package, preflow/publishing (Preflow\Publishing, since 0.71): the Publisher, LiveContent, PublishedModels, revisions, scheduling, share previews, config/publishing.php and the commands publish and publish:scheduled are described there. Folio registers it and binds its own rules: which types publish (below), the validation a publish runs, the languages (complete_languages, machine marks), the review index, redirects and the page-cache tags of the addresses a record leaves and takes.

Types with a frontend block and singletons publish by default. Set "publishing": true|false in the type JSON to override that.

How it works:

States are derived by comparing the two copies, and shown in the list and editor header:

The editor (since 0.75): the topbar holds a back button, the title with its state badges (Published, Changes not live, Draft), the content language (a dot per language: filled when complete, a warning ring when partial, a subtle ring when missing), Form / Split / Preview, the save state ("Draft saved 19:37", "Unsaved changes", "Saving…"), Save draft and the Publish split button. Its chevron opens Publish at…: with a date set the button reads Schedule. Without the publish permission there is Save draft alone; a type without publishing has one Save; a read-only form has no buttons. The side panel (320px beside the form from 1280px wide, under it below that, a sheet behind a topbar button on a phone) shows Publishing (state, the "N changes" since the live version, a schedule), Address (the address fields; "Renaming keeps a redirect from the old address." with redirects on; the old addresses), Languages (how far each is, visible-in, Translate with AI on), the Search result (title, address, description, or a pointer to SEO & sharing), Revisions, System fields, the extension panels and the Details card, and at the foot the record actions, Discard changes, Unpublish and Delete. The share texts are the SEO & sharing tab next to Content.

The preview bar (Split and Preview) has the device widths, the address being previewed (host of app.url and path; "· draft" while it differs from what is live), Copy preview link (it makes the share link, which lands under the bar with Revoke, and copies it: "Link copied · 7 days" from the link's real lifetime), Open (the live address in a new tab, while the record is on the site) and Focus. A record without an address in this language yet gets the device widths and Focus only. Both copy buttons (here and in the list's row menu) use Folio.copyLater(textPromise) from admin.js: called inside the click, it starts the clipboard write at once with the text still on its way (a ClipboardItem, which Safari needs), falls back to writeText, and resolves true or false. Extensions that copy what a request returns can use it too.

Keys: ⌘S / Ctrl+S saves the draft (also while typing; the browser's save dialog does not open), ⌘↵ / Ctrl+Enter publishes (where Publish is there), Esc closes the side panel on a phone, ? lists them.

The buttons and the side panel's record controls sit outside the record's <form id="folio-record"> and name it with the HTML form attribute (form="folio-record"), so a click sends every value of the record, the side panel's too, with the form's CSRF token; no script copies values. Controls a field's script adds later inside the side panel get the attribute too (editor-frame.js), and every edit of a control of the form is announced as folio:edit on it, the autosave trigger. A side field's <button> without type="button" becomes a submit of the record form. A control that is no record data (a search or filter box of a field) carries data-folio-no-edit (on itself or a parent): typing in it marks nothing unsaved, saves nothing and does not render the preview again.

Upgrading to 0.75: a site that overrides form.twig (an ActionResolver override or a theme) must give its submit buttons and any control outside the form form="folio-record", and render the new blocks (topbar_lead, the side panel partial partials/_side_panel.twig). The floating .folio-form-actions box and its .folio-publish-at are gone (the create drawer's buttons are .folio-drawer-actions; .folio-form-buttons stays for other forms' button rows); the record actions of extensions moved from the topbar to the side panel's foot, the Copy preview link button to the preview bar. Read-only fields left the form column for the side panel's System fields. The blocks editor's cards and picker changed markup (blocks/card.twig, blocks/field.twig): the move, duplicate and remove buttons are items of the card's "…" menu (same data-block-* attributes), .folio-block-actions is gone, the chevron (.folio-block-toggle, data-block-collapse) is the card's one toggle, and the picker's script is blocks.js (loaded with any blocks field, after admin.js). The field editors changed markup too (fields.js runs them, loaded after admin.js): a relation is rows plus a search ([data-folio-relation]; the checkbox chips, the single select and the remote chips are gone), an asset field is cards in a .folio-asset-box (its label a .form-label span), a matrix row has a grip and a trash button instead of Up / Down / Remove, the env field is .folio-env. The asset picker's pick message carries meta, warn and focal too (Folio.chooseAssets passes them on). A script that adds controls inside the side panel calls Folio.ownControls(node) (admin.js) before it announces the change, so they name the record form at once. Editors load admin.js, then fields.js, then editor-frame.js (the create drawer too). FieldRenderer writes a newline after <textarea> (the one the HTML parser drops), so a value that starts with a newline keeps it.

Editing:

Scheduled publishing: "Publish at" stores a date and time on the working copy. Publish what is due from cron:

The command holds a lock, so overlapping runs do nothing. A record that fails validation stays scheduled and is reported on every run. publish and publish:scheduled come with preflow/publishing; to make Folio's own commands available, list them in config/commands.php:

php preflow publish <type> [--id=<id>] [--all] publishes the drafts of a type at once. By default it skips records that are already published, and records whose legacy frontend.published field (e.g. status) does not say published. --all publishes every working copy, including unfinished edits.

"Publish at" is a wall-clock time in app.timezone (config/app.php), which Preflow applies on boot, in web requests and in the CLI alike. A time in the past is not stored.

Upgrading an existing site: publishing switches on by itself for types with a frontend block and for singletons. Until their records are published:

After deploying:

  1. On SQL storage, run the migrations below.
  2. Run php preflow publish <type> for each such type.
  3. Or set "publishing": false to keep the previous behaviour.

Share preview links:

Referenced records: relations, matrix placements and folio_url() follow the same rule on public pages: they show the published copy of a publishing type, and nothing for a record that is only a draft. The admin, the live preview and share-preview links show working copies.

Live content in your own code: read published content through Preflow\Publishing\Publisher. ->query('article') returns a QueryBuilder over the snapshots (or over the records themselves when the type does not publish), and ->live($type, $id) returns one record. Querying the type directly with DataManager returns working copies, drafts included.

Saving records in your own code: Folio saves every record through RecordWriter and deletes through RecordDeleter (preflow/publishing, from the container; see its README). Folio keeps only the forms, the permissions, the messages and the rendering: the writer runs the type's #[BeforeSave], the draft save or, for a type without publishing, Folio's validation (blocks included) and the live save (#[SaveRecord] where the type has one), the publish (validated), the list position, the review index, the addresses and #[AfterSave]. Save through it too and your code gets the same steps:

A save by someone who may not publish (mayPublish: false) cancels a pending "Publish at", as Folio's form, autosave, revision restore, bulk "Set …", "still correct" and AI translation do.

Saving working copies without the hooks: Publisher::saveDraft($record, $loadedVersion) saves without rules as version stored + 1 and throws VersionConflict (with ->current, the stored version) when the stored version is not $loadedVersion, also when another save lands between the check and the write. With null it does not check and retries on a newer version instead. A site form that saves a publishing type's record calls it with the version its form loaded:

saveDraft($record, null) can still throw VersionConflict in rare cases: when others save the record during each of its three tries, or inside your own transaction, where the retries reread the same snapshot.

Publishing in your own code: Publisher::publish($record, $by, $loadedVersion) validates, then writes the working copy only if it is still stored with $loadedVersion, then writes the snapshot (on SQL storage in one transaction). A stale version throws VersionConflict before anything is written. The working copy is written as version stored + 1 when its content differs from the stored one (any field but the id and Folio's _ keys: an approve that sets a status, an import), so an editor still on the old version conflicts instead of writing the old content back; unchanged content (Folio's form: draft save, then publish; the scheduler) keeps the version. Read the version from the record after publish(). Without the third argument (null) the working copy is written unchecked (same version rule), as the scheduler, publish and importers need. Folio's own form publish passes the version its draft save just wrote. discard($type, $id, $loadedVersion) and restore($type, $id, $revision, $loadedVersion) check the same way (they bump the version).

For a version-checked write outside publishing, use DataManager::saveTypeIfVersion() (see preflow/data).

States in your own code: ->state($working) reads the snapshot; ->stateWith($working, $snapshot) compares with a snapshot you already have (null: nothing published) and reads nothing. ->states($type) gives every working copy's state, ->states($type, $ids) those of some ids, and ->stateCounts($type) (since 0.77) how many are in each: these read only the working _version and the snapshot's _published_version (see preflow/publishing); an editor save that brings the content back to the published one (an edit undone by hand) marks the snapshot again, so it reads Published there as in state().

SQL storage:

Asset library

The library itself (uploads, variants, private files, usage sources, media_image()) is the preflow/media package: see its README. Folio adds the UI, installs the package and binds its rules to the package's hooks. Files and records are stored as before: public/media/Y/m/{id}.{ext}, the folio_assets table, storage/private-media, /media/… and /files/{id}.

Library screen at {prefix}/assets:

Asset fields store asset ids. The editor shows the selection with Choose, which opens the library as a picker in the drawer, and Upload, a plain file input that adds the file to the library on save, so it works without JavaScript. A field's accept (image/*, video/* or .pdf,.zip) limits what an upload may be. An asset field in a type's default template renders with media_image().

Permissions. assets.view (library and details page), assets.upload, assets.edit (details, extra fields, replace, restore, edit image), assets.delete (delete an asset or an earlier version).

Config. Library settings (directory, widths, quality, private and versions directory, extra fields, colour profile, …) live in config/media.php. Folio reads two private-file settings from config/folio.php:

For a members area (with private_url set in config/media.php):

A private asset field ("private": true) only takes private assets, and a public field only public ones; its picker lists just those, and choosing the other kind is a field error. Without the asset library, a private field refuses uploads. Export and pull carry the private files with their asset records (archive root private-media/); an archive from before private assets has no such root, and importing it leaves local private files alone. The earlier files of replaced assets (versions_dir) travel the same way, under the archive root media-versions/. Importing such an archive into a site without a versions_dir skips those files and says so in the output (Note: media-versions/: N earlier files skipped, …).

A refused upload in a field (wrong type, too large, not matching accept) shows as a field error, and the record is not saved.

A content type keyed assets keeps working on the site, but its admin list is hidden behind the library at {prefix}/assets. Rename the type to edit it.

Usage. Folio registers its record source with the media core; AssetReferences (the scanner it uses) stays in Folio and is not deprecated.

Older uploads: paths stored before the library existed keep rendering through {prefix}/_uploads. php preflow folio:assets:import [--dry-run] moves them into the library:

Dev server: the PHP built-in server must serve public/ as its document root for /media files:

public/index.php should return false for existing files under cli-server.

Deprecated in 0.34 (the class names removed in 0.72):

Old New
Preflow\Folio\Assets\Asset, Variant, AssetUploadException, ImageTag, ImageWidths, VariantGenerator, Image\* Preflow\Media\… (Image\* under Preflow\Media\Image\)
Preflow\Folio\Assets\AssetLibrary Preflow\Media\MediaLibrary
folio_image() media_image()
folio_asset_url() media_url()
config/folio.php assets (library settings) config/media.php (private_permission and private_login stay in folio.php)
php preflow folio:assets:variants php preflow media:variants

The old class names (Preflow\Folio\Assets\*, but AssetReferences, which is Folio's) are gone since 0.72: use the Preflow\Media names. The old template functions and command still work. config/folio.php assets is read only when config/media.php is missing, and never merged with it.

Extensions

An extension adds screens, type customizations, models and settings to Folio without touching Folio itself. A working one ships in examples/folio-demo/app/Folio/Demo; the examples below are copied from it.

Where they live. A project extension is a folder app/Folio/{Dir}/ with an Extension.php (class App\Folio\{Dir}\Extension). A package names its extension class in composer.json: "extra": {"folio": {"extension": "Vendor\\Pkg\\Extension"}}. Folio carries one itself: the members admin (members, in src/Members/), there when Composer lists preflow/members (in vendor/composer/installed.json) and its classes load; it needs the rbac extension enabled. A project's or package's own extension named members takes its place. Until 0.38 the admin was in the members package; an installed.json that still names Preflow\Members\Extension is ignored, and folio-extensions.cache rebuilds by itself. With the admin enabled Folio binds Settings → Members as the members core's MembersSettings and the member's edit page as MemberLinks (the link in the owner's mails). Whenever preflow/members is installed it binds its content locale as PageLocale, names @folio/frontend/_site.twig as the member pages' default layout (MembersDefaults), and it also counts published snapshots in a member's own deletion (MemberDeleteCopies) and carries the deletion into them (pointers cleared, cascaded pages unpublished; the snapshot gets no revision entry).

The codes admin (codes, in src/Codes/) is Folio's too, there when Composer lists preflow/codes: Library → Codes with the type code, the codes_purpose field, redemptions, expiry filters and the Revoke action (permissions code.view|create|edit|delete and codes.revoke). Its texts are the translation group codes, shipped by Folio. preflow/codes no longer needs Folio: it defines the type code itself and Folio's richer definition takes its place when the extension is enabled; the storage alias codes is optional (fallback default). The admin creates readable codes only; codes bound to a recipient come from Codes::issue(). See the codes README.

The members admin also locks and unlocks a member (a Locked pill over the state, sessions ended, sign-in refused while locked) and resends the confirmation mail to an unconfirmed one: the record actions lock, unlock and resend_confirmation (members.decide), offered in the Decision panel where they apply, with "Locked since" and "Last sign-in" lines. Needs preflow/members 0.39.

The folder's other parts are found by their attributes: Screens/* (#[FolioScreen]), Types/* (#[FolioType]), models/*.json (content types in the model JSON format) and templates/ (Twig, namespace @{name}, e.g. @demo/overview.twig). A part is named screen:{path}, type:{key}, model:{key} or settings.

prepareModel(array $schema, Container $c): array sees each of the extension's model schemas at boot, before a site's "extends": true file is merged, for what the JSON can't know: a storage alias that falls back to default when the site has not configured it, or select options from the site's locales.

Enabling. Nothing runs until config/folio/extensions.json, which is committed, lists it:

Every part of an enabled extension is on unless listed under disabled_parts, with one exception: a model whose JSON says "opt_in": true (and the extension's type part type:{key} for it) stays off until the site lists it under enabled_parts, so a new version can ship a model existing sites don't get unasked. Until then it is as if the extension did not ship it: no type, no table, no permissions.

folio:extensions:enable <name> --part=<id> and the Extensions screen write either list. A site without that file and without app/Folio/*/Extension.php behaves exactly as before. Misnamed classes, missing templates, duplicate routes and unknown names are errors on boot in debug (in production they are logged and the part is skipped); folio:extensions:check always treats them as errors.

Permissions. An extension declares each permission it uses with #[DeclaresPermission]; the name must start with {extension}., and the extension's label is its group in preflow/roles. The permission of a #[FolioScreen] and of a #[RecordAction] is declared by the screen or action itself (labelled with its label); repeat it with #[DeclaresPermission] only to give it a label of its own. A #[BulkAction]'s permission is not: declare it. An undeclared permission throws in debug. While the extension or the part is disabled its permissions are denied (and logged once), never a 500.

Management. Settings → Extensions ({prefix}/extensions, permission folio.extensions) lists extensions, parts and installed versions. It is read-only unless config/folio.php has 'extensions' => ['allow_admin_changes' => true] (default: app.debug); then it toggles extensions and parts by writing extensions.json.

Seeding on every deploy

install() runs once per version, so it cannot bring anything a later deploy adds. For data that must follow the code, such as the roles an extension creates, override seed() (since 0.53):

Screens

A screen is an admin page under the Folio prefix, in the sidebar, behind a permission. Its methods carry #[Get] / #[Post] with paths relative to the screen. The class is built from the container, so it can take constructor dependencies.

Screen assets

An extension ships its own CSS, JS and other files in an assets/ folder next to its Extension.php (app/Folio/Demo/assets/, or the package's extension folder). Folio serves them without login at {prefix}/_assets/x/{extension}/{path}, for enabled extensions only (a disabled or unknown extension, or any other path, is a 404). The URL Folio prints carries ?v= and the first 12 hex digits of the file's hash, so a changed file gets a new URL.

Copy Mermaid's whole dist/ folder, chunks/ included, to assets/vendor/mermaid/: the ESM entry mermaid.esm.min.mjs imports many chunk files, so shipping the entry alone 404s. (Or list the single-file mermaid.min.js as a classic script and use the mermaid global.) Files imported at run time are not versioned (they revalidate on every load); change the file name when you update them if you want long caching.

Mermaid writes inline style attributes and a <style> element into its SVG, and the admin's strict style-src (nonce, no unsafe-inline) blocks both. The example stamps the page nonce on the <style> element; inline style attributes can stay blocked, so check the diagram in the browser (console, CSP violations) and prefer Mermaid themes that style through the <style> element.

editor_assets (the template variable behind a field type's assets()) is internal to Folio's own pages; extensions use the options above.

Dialogs

Folio asks every question through one styled dialog (a native <dialog>, rendered once by each admin layout as partials/_dialog.twig); it never shows the browser's own confirm, alert or prompt. Extensions use the same dialog from admin.js, on every admin page:

Escape and a click on the backdrop cancel; the focus returns to where it was. A second question while one is open cancels the first. Without a layout's markup (a site that overrides the layout) admin.js builds the dialog itself.

Leaving with unsaved changes. A link, a breadcrumb, the sidebar, a row menu or a shortcut that leaves an editor with unsaved changes asks Leave without saving / Stay / Save and leave (where the form has a Save button: it saves with _folio_next, and a successful save goes to the link; a refused one shows the errors). An autosaving editor does not ask: its pending edits are saved at once and the page leaves when they are; only a save that fails asks, with the reason. ⌘/Ctrl/Shift/Alt and middle clicks, target="_blank", download, #hash links on the same page and other sites are not held. Closing the tab, reloading, typing an address and back/forward keep the browser's own question (no page can style it). Folio.navigate(href) goes to a page through the same guard; Folio.unsaved.isDirty(), .dirtyForms(), .clear(form), .onLeave(fn) and .pending() are the hooks behind it. Leaving without saving a side panel form still saves the record's own pending edits first (since 0.75).

The guarded forms are the editor's (.folio-form form, the side panel's, an asset's Details) and any form that carries data-folio-guard (the redirect form, the drawer's alt texts). A drawer is a page of its own in a frame, and removing the frame asks nothing: so Escape in the drawer, and the page behind's Close button, Escape and a click beside the drawer, go through Folio.leaveDrawer() in the drawer's page. While a guarded form there holds unsaved changes, its leave dialog asks, and only Leave without saving closes the drawer (since 0.76).

A confirmed action in an autosaving editor (a data-confirm form such as Unpublish) saves the pending edits first, then goes; if that save fails, the dialog's go-ahead names the action ("Unpublish without saving"). A form that throws the edits away carries data-folio-discards (Folio's Delete and Discard changes do): it saves nothing first, and the queued autosave is dropped (since 0.75).

Unsaved count and Cancel (forms without autosave, since 0.76). An editor whose type does not autosave (no publishing, such as Roles) shows "N unsaved changes" and Cancel beside Save, hidden while nothing is changed. admin.js takes a snapshot of the form's submittable values once the field scripts have run: what FormData would send for the form and the controls that name it with form="…" (the side panel's), without controls marked data-folio-no-edit and names that start with _ (_csrf_token, _locale, _version). Folio.unsaved.count(form) is the number of field names whose values differ from that snapshot, so a field kept in hidden inputs (rich text, blocks, relations, picked assets) counts and a radio group counts once. A multi-value name counts each value added or taken off: every name[] list does, the permissions matrix (permissions[]), relations, tags, multi-selects and checkbox lists, so ticking three boxes of the matrix says "3 unsaved changes"; the same values in another order count once (since 0.77). While the form holds unsaved changes the state never hides: when nothing is left to count it says "Unsaved changes" without a number.

Cancel calls Folio.unsaved.discard(form). When only visible controls changed, they go back to the page as loaded in place (disabled ones too), the form's unsaved mark is cleared, a bubbling folio:discard event is sent on the form, and fields.js's counters, date hints and steppers follow (Folio.initFields(root)). When a hidden input changed (or the restore does not reach the snapshot), Cancel reloads the edit page (the form's data-folio-edit-url, in the content language) past the leave guard once: a form without autosave has no server draft, so that shows the saved state. The server renders data-folio-edit-url on every form with Cancel (the record editor, an asset's Details form); a form without it is left as it is, still unsaved, rather than reloading the address bar's URL, which after a POST re-render is the form's action (since 0.77).

A refused save (a 422 re-render with the posted values) carries data-folio-refused on the form: it starts unsaved, so leaving asks, the state says "Not saved" (or the count once something else changes), and Cancel reloads the edit page. The markup is form.twig's [data-folio-unsaved-state="<form id>"] and [data-folio-discard="<form id>"]; any non-autosaving form can carry them.

For field and extension authors: a field that changes controls from script should send a bubbling change (or input) event for each (fields.js does so for Trix's trix-change), so the count and the leave guard see it as a click. A field whose visible controls have derived state (locks, previews) listens for folio:discard on its form and rebuilds that state from the restored controls; the permissions matrix (rbac_permissions) re-applies its locks there. A field kept in hidden inputs needs nothing: Cancel reloads the page for it.

Field scripts that write late: the settling protocol (since 0.77). The snapshot is taken at boot and again once the deferred scripts have run (DOMContentLoaded). A field whose script writes its value later than that (an editor that loads asynchronously and normalises its content, a value fetched from the server) marks its field element data-folio-settling, rendered by the server or set by its script before DOMContentLoaded, and says it is ready in one of two ways:

Until a settling field of a form (inside it or in a part naming it with form="…") is ready, its names are retaken into the snapshot instead of counted, and its own input and change events mark nothing unsaved; the person's edits to the form's other fields count (and Cancel restores them) as always. When the field is ready its names are retaken once more, so what it wrote is the form as loaded. A field still settling after 10 seconds is taken as settled: admin.js removes the attribute, warns in the console naming the field, and its changes count from then on, so counting is never off for long. Mark a field only while it is really loading.

Type customizations

A class with #[FolioType('note')] customizes the admin of an existing type (an unknown key is a boot error). It is built from the container; its methods carry:

Attribute Method signature Effect
#[FormPanel(label, position: 'after')] fn(DynamicRecord): ScreenView\|string\|null A panel on the edit form (not on create), before or after the form's fields, or side: a card in the editor's side panel (since 0.75 the 320px column at the right from 1280px, also next to the preview; under the form below that), after Folio's own sections and before the Details card. A string is shown as escaped text, a ScreenView as a template fragment (it gets prefix, csrf, type, id and record). Returning null hides the panel (no heading, no box, and no side column or extras section on its account; an empty string still renders an empty panel). Any other position is a boot error.
#[RecordAction(name, label, permission, icon, confirm, toolbar: true)] fn(DynamicRecord, ServerRequestInterface): ?ResponseInterface A POST button at {prefix}/{type}/{id}/_action/{name} (since 0.75 at the foot of the editor's side panel, and in the list's row menu); null redirects back to the form with "{label}: done". Needs the permission and the type's edit permission. With toolbar: false there is no button in the editor or the row menu; the action stays routed and permission-checked, for a form inside a FormPanel to post to.
#[ListColumn(label, position: 100)] fn(DynamicRecord): string\|Badge\|Link A column after the type's own, ordered by position, shown as escaped text, as a link for new Link($label, $url) ($url is member/3/edit, relative to the admin prefix, or a site path like /shop/order?id=3; anything with a scheme, host, //, backslash or whitespace is no link and shows the escaped label), or as a status pill for new Badge($label, $tone) (tone '', published, draft, changed, scheduled, failed or incomplete; the label is escaped, an unknown tone is shown plain).
#[NavBadge] fn(): ?int A count badge on the type's sidebar item (e.g. waiting members); also on a #[FolioScreen] class (see Screens), computed only while the item is visible and at most once per request; null, 0 or any non-int return shows none, a callback that throws shows no badge (the admin still renders), several add up, one per class. Keep it cheap: it runs on admin page renders.
#[ListNotice] fn(): ?string A notice above the type's list (since 0.53), on the full page only, not on live-search refreshes. The method returns HTML that Folio prints as it is, so it escapes its own content (usually by rendering a Twig template). Use Folio's .folio-notice markup, e.g. <div class="folio-notice" role="status"><p>…</p></div>, for the spacing (a list of items inside it: <ul class="folio-notice-list">, no bullets). Since 0.73 that is the info tone (blue). Add is-warning (<div class="folio-notice is-warning" role="status">) for the amber warning tone; see Admin styling. null or '' shows nothing, and so does a throw. Several add up, grouped by type (in the order the types' customizations were registered), each type's notices in extension name order.
#[DashboardNotice] fn(): ?string A notice above the dashboard's "Needs you" section (since 0.53), the same rules as #[ListNotice]. Only called for a user who may view the type ({type}.view); the notices are grouped by type (in the order the types' customizations were registered), each type's notices in extension name order.
#[DashboardItem] fn(): ?Preflow\Folio\Dashboard\NeedsYou A card in the dashboard's "Needs you" section (since 0.76): new NeedsYou($title, text: …, url: …, tone: 'warning', icon: null). The title says what waits ("3 orders to ship"), the text how to go about it; the whole card links to url, a path relative to the admin prefix (order?status=open) or a site path, as Link takes it (anything else shows no card). tone is warning, info or danger (another tone throws \InvalidArgumentException when the NeedsYou is built, so the card is not shown); icon is an icons.svg id (ui-shield), null the tone's. The method must declare that return type (a boot error otherwise). Only called for a user who may view the type ({type}.view); null or a throw shows nothing. The cards follow Folio's own (changes not live, not-found addresses, translations to review) in the same order as #[DashboardNotice]: by type, in the order the types' customizations were registered, then each type's in extension name order. The section is hidden when there are none, and it loads just after the page (htmx), as does the cache line. Folio's roles extension announces new permissions this way.
#[FieldPlaceholder(field)] fn(string $locale): ?string What the field means while it is empty, as its placeholder in the edit form in the locale being edited (e.g. a standard text from the lang files); it replaces the "falls back to" placeholder of a translatable field. The field must exist on the type (boot error), one per field.
#[BeforeSave] fn(DynamicRecord): void, or fn(DynamicRecord, WriteKind $kind): void Before validation; may set() fields. Throw Preflow\Validation\ValidationException to refuse the save: nothing is stored, the form is shown again with its errors (422). Runs on every save through the RecordWriter (see Saving records in your own code): the form, autosave, each record of the bulk bar's "Set …", both records of a list move, "still correct" of a translation, AI translation (since 0.71), "Add to role" on the new-permissions notice, the detached records of a member's own deletion (a refusal there is logged; the deletion stands), and an app's own writer calls. A method whose second parameter is typed Preflow\Publishing\WriteKind gets the kind of write (since 0.71): Save (the form, "still correct", "Add to role", an app's own save()), Autosave, Bulk, Reorder (a list move), Translate (AI translation) or Detach (a delete takes the deleted ids out of the record), so a hook can leave some alone, e.g. skip image work on autosave.
#[SaveRecord] fn(DynamicRecord $record, ?DynamicRecord $previous): void Writes the record itself instead of the whole-record save, for types without publishing: after #[BeforeSave] and validation, before #[AfterSave], on every save through the RecordWriter (the form's create and update, the bulk "Set …", AI translation; a list move's positions too, there without validation). $previous is the stored record before the change, null for a new one. One per type (a second is a boot error). Throw ValidationException to refuse the save (422, the form shown again). Use it when the store has rules a whole-record write would break, e.g. a counter changed at the same time.
#[AfterSave] fn(DynamicRecord): void, or fn(DynamicRecord, WriteKind $kind): void After the record is stored, on the same saves as #[BeforeSave], with the same optional WriteKind; on a publishing type also when the publish after the saved draft fails.
#[BeforeDelete] fn(DynamicRecord): void Throw Customization\Refused('message') to keep the record; the message is shown to the editor.
#[AfterDelete] fn(DynamicRecord): void After the record is gone.

A decision panel in the side column, with its own form and tabs:

Use one form (and one toolbar: false RecordAction) per tab, so a click on a send button says which decision was made and only that panel's fields are posted.

A button that needs a change (since 0.75): give a panel form's submit data-folio-needs-change and admin.js keeps it disabled until a control of that same form changes (a reset disables it again); edits elsewhere on the page do not count. A transfer card's "Transfer" stays off until a new owner is picked:

Without script the button works as a plain submit, so the action checks the posted value itself.

Tabs: <div data-folio-tabs> holds a .folio-segmented of <button data-folio-tab="key"> and sibling <div data-folio-tabpanel="key"> panels. admin.js adds the ARIA roles, arrow keys (Home/End too) and hides the inactive panels; the first tab is active unless one carries data-folio-tab-active. Panels are focusable. Without JS every panel shows, stacked, and the tab buttons stay hidden.

Things to know:

Extending an extension's type

A site adds fields to a type an extension ships (and to its {name}_settings singleton) without forking it: a model file in config/models/ whose key is that type and which says "extends": true.

Settings

Extension::settings() returns a form in the model JSON fields format. Folio shows it under Settings as the singleton type {name}_settings (no publishing), labelled "{extension label} settings" (e.g. "Members settings"), and reads it with the declared defaults. Overriding settings() declares the settings part; discovery sees that without instantiating the extension, so a disabled extension's constructor never runs. An enabled one whose settings() returns no fields is an error on boot.

Cache screen

Settings → Cache ({prefix}/cache, permission folio.cache; staff with * have it) lists every cache registered with Preflow\Core\Cache\CacheRegistry as a table row: label, entries, size and a Clear button, plus Clear all. Folio registers folio.extensions and the blocks cache (blocks, preflow/blocks); core registers data.json (when the JSON driver is in use) and blade (when the Blade engine is in use). A site registers its own:

An OPcache table shows the status (memory, scripts, hit rate) with Reset OPcache. OPcache is per SAPI: the web request resets the web pool's cache; the CLI cannot see it, so the button is a web-only action. The same registry backs cache:list and cache:clear <key>… | --all (devtools).

With the page cache on (preflow/core's README, "Page cache"), its row is pages (clearing it empties the cache), and a Page cache section has the two manual actions: Refresh a page (a path such as /about, or the full address: every cached copy of it is forgotten and it is rebuilt behind the response) and Refresh everything (every page is forgotten and the known pages are rebuilt in the background, the rest by preflow pages:work). Pages refresh themselves on every write; these are for changes the site can't see. They are core's Refresher::refresh() and refreshAll(), the same as preflow pages:refresh.

Redirects

Old links keep working. Folio remembers every page's public addresses and answers an old one with a redirect, through preflow/routing's RedirectMiddleware (see its README for when a redirect applies and config/redirects.php). Folio supplies the store, the automatic entries, the prompt when a page goes away and Settings → Redirects.

Renamed pages

When a record's public address changes (any field its route is built from, in any language), its old address answers with a 301 to the record's current address. That covers a publish (also the scheduler and a revision restore) and, for types without publishing, a plain save. Every old address points at the record itself, not at an address, so a page renamed twice redirects from both old addresses straight to the current one. A record that loses its address in one language only (translated slug cleared, language removed) redirects that address to its default-language address. The address a page holds now always shows the page: renaming A → B → A drops the entry at A, and B redirects to A.

Removed pages: "Send its old links to…"

Deleting a record that has public addresses (single, bulk, or records deleted by cascade) and unpublishing one asks, in place of the plain confirmation, where the old links go:

The three are radio cards (the chosen one opens to its search or input; the arrow keys, Home and End move the choice). The dialog's title names the record when the form carries data-removal-label ("Delete “About”?", "Unpublish “About”?"; the list's and the editor's forms do), else it is the form's own question.

The form posts the choice as _redirect_to (type:id or the URL); the server checks it again and treats anything it can't use as no target. A bulk delete has one target for the whole batch; records deleted by cascade get the same one.

The server also follows the target to where it really leads, so old links never end in a chain:

Choosing needs only the right to that delete or unpublish. Without JavaScript nothing is asked and the old links answer 404. A type without publishing that leaves the site by its status field shows a warning after the save instead, with a link to the record's redirects for those who may manage them.

What a removal does to the other entries that point at the record:

When the record comes back to the site, its own "removed" entries point at it again and are automatic once more, whatever target the removal gave them; hand-made entries, areas and other records' entries keep the target the removal gave them.

The "Old addresses" note

A record's editor shows the addresses that send visitors to it in the sidebar, as visitors see them (/about, /de/über-uns), at most ten and then how many more, with a link to its redirects ({prefix}/redirects?record={type}:{id}) for those with redirects.manage. The note is hidden when there are none.

Settings → Redirects

{prefix}/redirects, permission redirects.manage (the automatic entries need none: they follow from publishing). Two tabs:

The form opens in the drawer (?_drawer=1; the list reloads after a save) and is a page of its own without script. A hand-made entry has an old address, typed after the form's / (a query or fragment is left out), with its language: on a site with locale prefixes a select offers one of the site's languages (a new entry starts in the default one) or "Any language", and a language prefix typed in front (/de/werkstatt) still wins; without prefixes entries are language-neutral. Posted without the select, the prefix or else the default language decides, as before. "Send visitors to" is A page (a search over _targets, the pick shown with its type and URL) or An address (a URL or path); both post the one field target, and without script the address input takes type:id too. It can cover everything under it (an area): either all to one target, or keep the rest under a new address (/workshops-2024/basel → /workshops/basel, a URL or path target without ? or #). Hand-made entries answer 301 (default) or 302; automatic and removed-page entries are always 301.

A typed path or URL where a page answers, in the entry's language, is stored as that page (as if it had been picked), so the entry follows the page when it moves; not for "keep the rest" (the rest of the path is appended to the URL), nor with a ? or # (kept as typed).

The form refuses what could never work or would loop:

Storage and upgrading

Three internal tables in the default storage: folio_redirects (the entries), folio_addresses (each record's current public address per language) and folio_not_found (at most not_found_limit addresses, 1000 by default; the least recently hit go first; path, language, count, first and last hit, nothing about the visitor).

Upgrading to 0.52: SQL sites run preflow migrate, which creates the three tables and records every live page's current addresses. Until it has run, pages, 404s, publishes and deletes behave exactly as before (the redirect pieces catch the failure and log it in debug mode). Without that run, the first rename of a page after upgrading redirects only for publishing types (their previous live copy still holds the old address); after it, for every type. On a JSON-only site preflow migrate has nothing to do: addresses are recorded as records are saved or published, so the same holds there for each record's first rename.

Records written by folio:import don't get automatic redirects for renames the import makes (the importer writes rows directly); run preflow migrate afterwards to record their addresses.

Until preflow migrate has run on a SQL site, Settings → Redirects says so instead of showing the lists.

Settings → SEO audit

{prefix}/seo-audit, permission seo.audit, on every site (also without SQL storage). The last report of the SEO audit (see the SEO audit section in packages/view/README.md): when it ran and on which site, whether it is complete or how many pages it has done, the number of findings per severity and the findings grouped by check, most serious first. Each finding links to its page and, for content findings, to the record or library asset to fix, for users who may open them ({type}.view / assets.view). The texts come in en, de and fr.

Since 0.74 a user who also has seo.audit.run runs the audit on this screen, through preflow/view's Audits (the same steps and report as preflow seo:audit, which still works and is named under the buttons):

The audited pages are the published site as a visitor gets it, also when the step runs inside the admin (which otherwise shows working copies): every internal render reads published snapshots with empty memos, the same isolation the page cache uses.

Operations:

Both routes need seo.audit; the controller adds seo.audit.run (403 without it; then the screen shows no buttons). With rbac, the new permissions are announced in Settings → Roles like any new permission: the admin role (*) has them, other roles get seo.audit.run only when someone adds it.

User types and transfer

A type can hold the site's own users or members:

Signing users in. Preflow\Auth\Record\RecordUserProvider is a user provider over a user type, for a SessionGuard in config/auth.php:

SQL storage

Folio content can live in SQLite by setting "storage": "sqlite" in a type's model JSON (a storage named in a model that is not configured in config/data.php is an error, not a fallback to the default). Tables come from the model JSON, with no migration files:

Live content to local: folio:pull

Content is edited live; code goes through git. To work on a copy of the live content:

The same archive works without SSH, as a content backup and restore:

There is deliberately no folio:push: it would silently overwrite live edits.

Translations

With more than one locale in config/i18n.php, fields marked "translatable": true hold one value per language: {"en": "About", "de": "Über uns"}. Everything else is shared across languages. With a single locale, the flag has no effect and values stay plain.

Editing:

Website:

Validation: required applies to the default language only. Other rules apply to every language that has a value; errors are keyed field.de.

Older values stored before a field became translatable keep working as the default language's value. Upload fields are always shared.

Missing and outdated

Folio checks every translatable text of a record: translatable fields, the translatable fields of blocks (also nested ones) and the texts a custom field type reports.

Custom field types. A field type that keeps locale maps inside its own value tells Folio about them by implementing Preflow\Folio\Field\ReportsTranslatableTexts. Paths and labels are relative to the field; Folio prefixes them with the field's name:

Use a stable key in the path (an id, not the position) when items can be reordered, so a fingerprint follows its item.

Taking part in AI translation. Reporting texts is only half of it. To let AI translate the texts of your field, the field type must also implement Preflow\Folio\Field\AcceptsTranslatedTexts, the way back: Folio hands it translated texts by path and it returns the field value with them set. Only the field type knows how its value is built, so only it can do that.

Set only $locale, leave every other language and every other text as it is, and ignore paths you do not know. A field type that reports texts but does not implement AcceptsTranslatedTexts is left out of AI translation, so no money is spent on a text that could never be stored. A text may also carry a kind (TranslatableText::of($path, $label, $raw, $locales, 'faq-answer')), which lets tuning target it (see "Field options" below).

SQL storage: translatable values and the record's _locales list are stored as JSON text. A SQL-backed type needs a _locales (TEXT) column, and its translatable columns must be wide enough for the JSON map. JSON-file storage needs no setup. folio_alternate_links() emits absolute URLs when the request has a host, which search engines require.

Translate with AI

With AI on (config/ai.php enabled and the provider's key, see preflow/ai), each language tab except the default gets a Translate button, for users with the ai.translate permission ("Use AI translation") and the type's edit permission. With AI off there is no button, the form's markup is unchanged and the endpoints below answer 404.

On a record, Translate queues a background job. The dialog asks which texts (Missing and outdated, or All) and an optional one-off note, and shows the estimate for this record. Confirm queues a job for this record and language and says "Queued". You can leave the page.

Interface labels (Settings → Translations) and media alt texts still fill their inputs at once and show a review row under each text: Accept keeps the text as checked, Discard puts back what the field held, and editing the text counts as checking it. They answer in seconds, so they need no queue. On Settings → Translations, when the selected language is the source language, the screen asks you to choose a language to translate into.

The endpoints (all POST, with the CSRF token):

Without ai.translate they answer 403. The ai.settings permission ("AI settings") is declared too.

Waiting for review (dashboard)

With AI on, the dashboard has a Waiting for review section for users with ai.translate:

The records come from the review index (see "Review index" above), so the dashboard does not load every record.

Translating a whole type

Under the same conditions the list has Translate all… in its header and Translate… in the bulk bar (the ticked records). The run screen asks for the languages, the texts (needed or all) and a note, then shows the plan: "N records, M texts, K requests, about $X". Start queues one job. The cron worker translates it one record per step, so the page can be closed.

The routes (all ask ai.translate and the type's edit permission; POSTs need the CSRF token): GET|POST {prefix}/{type}/_ai/run (form; step=estimate plans the job), and POST {prefix}/{type}/_ai/jobs/{job}/start|step|stop, which answer the progress partial for htmx and the whole screen otherwise. A job is only reachable through the type it translates. Jobs are stored in storage/ai/jobs/{id}.json.

Field options

A model's field can tune or leave out AI translation with an ai block in its JSON:

These are the defaults. A text saved in Settings → AI → Tuning under the key {type}.{field} or {type}.{field}:{kind} replaces the default of that level and leaves the others alone.

Settings → AI

The AI entry in the Settings section needs the ai.settings permission. It stays visible while enabled is true even without a key, so an admin can see why nothing works ("switched on: yes, key: no"). It has three screens:

Edits are stored in storage/ai/settings.json, apart from config/ai.php.

Labels and media

Folio's own pieces get the same button, with the same review and the ai.translate permission:

Labels and alt texts have no "outdated" or "not checked" tracking: their stores keep no fingerprints, and both screens are reviewed in full anyway.

Trying it without a key

Name a provider of your own that returns Preflow\Ai\Testing\FakeAiClient, on your machine only (config/ai.php 'provider' => App\Ai\FakeTranslations::class with 'enabled' => true; no key needed). This one answers every text with "[de] " and the text:

Then open a record's German tab and click Translate. The job is queued; run php vendor/bin/preflow translate:work by hand to work it. Reopen the tab: the AI texts show "Machine-translated, not checked yet" until you publish the record.

Upgrading to 0.47

SQL sites: run preflow migrate after upgrading. Every save in a second language now stores the source text next to the fingerprint (_translated_source) and the machine-made marks (_machine_translated), also with AI off. On SQL storage these are new TEXT columns on each record table and its published and revisions tables; until preflow migrate adds them, publishing a record and saving a translation fail. JSON-file storage needs nothing.

Upgrading to 0.48

Background translation. See docs/superpowers/plans/2026-10-30-release-0.48-checklist.md.

Write a draft with AI

Since 0.77. With AI on, every rich-text toolbar has Write a draft at its right, also in block cards added later, for users with the ai.draft permission ("Write drafts with AI") and the type's edit permission (on the create form: its create permission). The seeded admin role (*) has it; other roles get it on the Roles screen. With AI off there is no button, no script and the form's markup is unchanged, and POST {prefix}/_ai/draft does not exist.

The dialog asks What should it say? and the length (Short, Medium, Long), then Write shows the draft, read only, with what it cost ("This draft cost < $0.01.", or that the cost is unknown when the model has no price). Insert at cursor puts it where the caret was, Replace text replaces the field's text, Try again writes anew, Cancel (or Escape) leaves the field as it was, as does a failure. Insert and Replace are ordinary edits: Trix's own parser takes the HTML as one undo step, and the unsaved state and autosave see them; nothing is saved behind your back. A draft written on a language tab is not marked as machine translated: it is your text once you insert it.

Admin languages

Folio's own screens, the staff mails and the admin parts of rbac, members and codes come in English, German and French. Each staff user picks the language of the admin for themselves; the content languages (config/i18n.php) are separate.

Choosing the language:

Changing a text: the Translations screen. Settings → Translations ({prefix}/translations, permission translations.edit) lists the texts of every admin group (Folio, rbac, members-admin, codes, the extensions' groups) and the site's model labels, per language. A changed text replaces the delivered one in the admin for everyone using that language; Reset brings the delivered one back.

Editable site texts. A site's own text groups that staff should change themselves (a mail's subject, a notice on a page) are listed in config/folio.php:

The screen offers each listed group besides the admin groups, in every language of config/i18n.php (not the admin's languages), with the note that the texts appear on the website and in mails. Its overrides apply on every request (Translator::alwaysOverride()): public pages, mails in the recipient's language (t($key, $params, 'fr')) and console or queue mails. Plain text as above, and an override keeps exactly the :placeholders of the delivered text (the language's, else the fallback language's, else English: what visitors and mails get today, shown as the delivered text): dropping :link or adding an unknown :foo is refused; a colon followed by letters counts as a placeholder (:name), so a text like mailto:info@… is checked as one. The keys are those of lang/{locale}/{group}.php in every site language (only two-letter languages are offered; region locales like de-CH are not listed). An entry that is not a group name, site (the model labels stay admin-only) or an admin group (folio, rbac, …) is skipped with a line folio: translations.editable: … in the error log; boot goes on, and every group not listed renders exactly as before.

Model labels. A model file's label, label_singular, a field's label and help and a select option's label can be a plain string or a map per language:

Or keep the plain English string and add keys to lang/{locale}/site.php:

Text Key
type label / singular site.types.{type}.label / site.types.{type}.singular
field label / help site.fields.{type}.{field}.label / site.fields.{type}.{field}.help
select option site.options.{type}.{field}.{value}
sidebar section (also a section only a screen names) site.sections.{section}
extension screen label site.screens.{name} (#[FolioScreen('queue', 'site.screens.queue')])
empty list sentence site.types.{type}.empty (optional)

A key wins over the map, the map over the plain string. They show in the sidebar, the dashboard, list headers, filters, chips, bulk menus, the Excel header row, the editor and the roles screen; public pages are unchanged. label_singular gives "1 Seite" in the delete summary; without it English guesses and other languages use the label.

A project's own extension (in app/Folio, no translations: group) uses site.* keys for its attribute labels too: #[ListColumn('site.columns.kind')], #[FormPanel('site.panels.check')], #[RecordAction(label: 'site.actions.go')].

Extensions. An extension that ships texts declares its group in its package's composer.json (see preflow/i18n) and names it on the extension: #[FolioExtension(name: 'shop', …, translations: 'shop')]. Then:

In templates, folio_date(value, 'date'|'datetime') and folio_number(value) format in the admin's language (German 26.10.2026, French 26/10/2026, English Oct 26, 2026); t() reads any key. Block labels may be keys too: #[Block(label: 'site.blocks.hero.label', group: 'site.blocks.groups.sections', description: 'site.blocks.hero.description')] and #[BlockField(label: 'site.blocks.hero.title', help: …)] are shown in the admin's language (block picker, cards, field labels and help, the preview's block label) from lang/{locale}/site.php; plain text stays as written.

Status

Shipped:

The admin runs under Preflow's strict, nonce-based CSP: no inline handlers or styles. Hand-written <script>/<style> tags in your own templates need nonce="{{ csp_nonce() }}".


All versions of folio with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
preflow/core Version ^0.82.0 || @dev
preflow/data Version ^0.96.0 || @dev
preflow/view Version ^0.74 || @dev
preflow/twig Version ^0.65 || @dev
preflow/routing Version ^0.78.2 || @dev
preflow/form Version ^0.75 || @dev
preflow/validation Version ^0.94.0 || @dev
preflow/auth Version ^0.83.0 || @dev
preflow/blocks Version ^0.96.0 || @dev
preflow/publishing Version ^0.96.0 || @dev
preflow/components Version ^0.1 || @dev
preflow/htmx Version ^0.65 || @dev
preflow/i18n Version ^0.83.0 || @dev
preflow/media Version ^0.89.0 || @dev
preflow/notify Version ^0.69 || @dev
preflow/devtools Version ^0.85.0 || @dev
preflow/fields Version ^0.96.0 || @dev
nyholm/psr7 Version ^1.8
symfony/html-sanitizer Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package preflow/folio contains the following files

Loading the files please wait ...