API

Every class and method in PhlatPage, read from the code itself.

A cheatsheet of the objects you work with in routers, controllers and templates, and the Toolkit's static helpers. Each name links to its full entry: the signature, parameters, return type and the source line it comes from.

The search box finds methods too: type slug for Str::slug() or children for $page->children().

Most used

objects

AddonPage

$addonPage 7

A page whose view comes from an addon, resolving its views from the addon folder rather than the site.

App

$app 53

The application core.

Collection

$collection 15

Every item of one collection field - data with no URL of its own, like comments, likes or tags - in a SQLite database at data/collections/{field}.db.

Field

$field 0

A global field definition - its type, label and options - read from fields/{name}/_index.json with its `extends` chain applied.

FieldType

$fieldType 12

How one kind of field encodes, decodes, validates and indexes a value.

FieldValue

$fieldValue 11

A field as one record holds it: the value with its definition (type, label, options) and where it lives (context).

Item

$item 5

One entry of a collection field.

Options

$options 4

Visitor options the server renders: theme, density, a dismissed banner.

Page

$page 64

A page on the site.

PageCollection

$pageCollection 4

A RecordCollection of Page objects.

PageFile

$pageFile 4

A File that is publicly visible and knows which page it belongs to.

PageFiles

$pageFiles 33

Manages every file owned by a page/item/user - identified by owner UUID + filename - including its index, public mirror, and image variants.

PageImage

$pageImage 16

A PageFile that is an image. transform() (and the src()/srcset() helpers built on it) only compute the target variant URL and record the requested options via Registry::setVariant() : no pixels are touched here.

Record

$record 17

Base for anything stored as an _index.json + _data.json folder (Page, User).

RecordCollection

$recordCollection 22

A lazy, immutable list of records.

Registry

$registry 19

SQLite index of every page UUID with its path, view, status and timestamps. find() queries it with the comma-separated DSL.

Request

$request 15

The current HTTP request: path segments, query, post body, uploaded files, and whether htmx sent it.

Router

$router 9

Holds the routes a view registers for its page, plus before and after hooks.

Session

$session 6

Session values and flash messages under one name, so views and addons can't overwrite each other's keys.

SessionRoot

$sessionRoot 17

The visitor's session as `$app->session`: login, the signed-in user, permissions, CSRF and throttling.

User

$user 13

A user account.

toolkit

Arr

Arr:: 43

Array helpers: map, filter, find, sort, pluck and friends.

Cli

Cli:: 18

Terminal output and input for CLI commands: messages, tables, progress bars and prompts.

Color

Color:: 10

Color helpers: read any CSS color (#hex, rgb(), hsl() or oklch()) into rgb/hsl, pick a readable text color, lighten and darken.

Cookie

Cookie:: 6

Low-level cookie handling: HttpOnly, SameSite=Lax and Path=/ always, Secure on https.

Db

Db:: 13

PDO connection handling and SQL execution, used by the registry.

Dir

Dir:: 17

Directory helpers: list, create, move and delete folders.

Dt

Dt:: 13

Dates and times: now, parse, format, diff and relative "ago" strings.

F

F:: 28

File helpers: read, write, resolve, copy, symlink and mime type.

Git

Git:: 39

Runs git commands against a repository: status, add, commit, log, diff and restore.

Hash

Hash:: 7

Hashing, password hashing and verification, and random tokens.

Http

Http:: 7

Outbound HTTP requests returning an HttpResponse.

Hx

Hx:: 9

Sets htmx response headers: redirect, location, refresh, push and replace URL, trigger, retarget and reswap.

Invoke

Invoke:: 1

Calls a function, matching available values to its parameters by name.

Json

Json:: 4

JSON encode and decode.

Jwt

Jwt:: 1

Signed JSON Web Tokens: RS256 verification against a provider's published keys (its JWKS).

Lock

Lock:: 1

Exclusive file locks that serialize work across PHP processes on one host.

Log

Log:: 1

Writes to the PHP error log - stderr under php-fpm, so it lands in the container logs.

Num

Num:: 15

Number helpers: format, round, abs, clamp and friends.

Proc

Proc:: 1

Runs a command as a child process, array-form so nothing is interpolated into a shell.

Res

Res:: 13

The HTTP response: status code, headers, redirects, and sending html or text.

San

San:: 9

Sanitizes untrusted input into clean text, email, url and similar values.

Ser

Ser:: 2

PHP serialize and unserialize.

Ses

Ses:: 17

Low-level PHP session handling.

Srv

Srv:: 17

Read-only access to server and environment values: host, scheme, ip, headers.

Str

Str:: 47

String helpers: case, slug, search, replace, split and join.

Url

Url:: 12

Parse, build, encode and decode URLs and query strings.

V

V:: 23

Validation rules: required, email, length and more, plus check() to collect errors.