Page
A page on the site.
Properties (14)
| $page->router | Router | readonly | |
| $page->view | ?string | readonly | |
| $page->published | bool | readonly | Whether this page is live - true unless _index.json says false. |
| $page->access | string | readonly | Who may open this page: '' for anyone, 'login' for any signed-in user, or role names joined by '|'. |
| $page->hidden | bool | readonly | Whether this page is left out of navigation and child lists. |
| $page->position | int | readonly | Where this page sits among its siblings when its parent's view sorts by `position` - set by dragging it in the admin tree. |
| $page->uri | string | readonly | |
| $page->path | string | readonly | |
| $page->objectRoot | string | readonly | |
| $page->uuid | string | readonly | |
| $page->locked | bool | readonly | |
| $page->created | ?int | readonly | |
| $page->updated | ?int | readonly | |
| $page->isRoot | bool | readonly |
Identity 7
- fragment Whether this page renders as a bare fragment - its own _index.json wins over the view's default.
- objectType Always `page`.
- boundClass The class App::loadType() looks for when views/{name}/{name}.php declares a bound subclass, e.g. "article" -> ArticlePage.
- registryKeyFor Builds a page registry key from a raw page uuid, for callers without a live Page instance.
- registryPath The path stored in the registry for this object.
- registryFields Extra registry columns this object type contributes (e.g. view for pages, role for users).
- isSourced Whether this page's parent is a PageSource: its content comes from that source, and it is never in the registry.
Saving 3
- save Persists page data, routing structural fields to _index.json and the view's fields to _data.json.
- delete Deletes this page and its persisted subtree - PageCollection::delete() for one page, which has the details.
- move Moves (or renames) this page and its whole subtree to $newPath, e.g. "blog/2026/post".
Fields 6
- fields Returns this page's template fields as resolved FieldValue instances.
- settingFields The structural settings an editor sets - published, access, hidden, locked - as FieldValues, so the admin edits them with the same field UI as everything else.
- childFields The fields a new child is made from: its name, unless this view names pages by uuid, and its view when there is a choice.
- viewFields The view a page without one is given: the ones its parent's view takes, or any when it names none.
- moveFields The fields a move is made from: the page's name and its parent, any page whose view takes this one's (or where it is now).
- viewConfig Returns app-level config under $key merged with this view's override of the same key.
Drafts 5
- hasAutosave Whether an unsaved draft exists for this page.
- autosave Persists a draft of the view's fields outside the normal save path - no _index.json, no registry, no git.
- discardAutosave Clears any pending draft.
- data The page's content.
- withData This page reading $data as its content, in place of its files and any draft.
Rendering 6
- view The view that renders this page; throws when the page has none.
- session Session data scoped to this page's own view - auto-namespaced, no manual scope('name') needed.
- emit Fires `{view}/{event}`, this page's own view as the prefix, so a page can't spell a core event (core names have no slash).
- controller Includes a view's controller file and calls it if it returns a callable; returns the resulting data array.
- render Renders the page view, merging in global and view-specific controller data.
- cache This page's part of the pages cache.
Access 3
- isPublic Whether anyone at all may open this page - it and every ancestor published and open to all - whoever is asking.
- isViewable Whether the current visitor may open this page.
- assertViewable Throws what the current visitor gets for a page they may not open: a 404 for an unpublished one (it doesn't admit to existing), a login redirect for a gated page when signed out, a 403 when signed in without the role.
Routing 5
- route Dispatches the request sub-path against this page's view router.
- remainder Returns the request path after stripping this page's own URL prefix, trimmed of slashes.
- target Resolves remainder() as a Page, the common case behind most remainder() call sites.
- segment Returns the nth segment (1-indexed) of the request sub-path, or null.
- url Returns the site-relative URL by stripping the pages/ root from the filesystem path.
Tree 18
- parent Returns the parent page, or null if this page has no parent (including root pages).
- parents Returns all ancestor pages from root to immediate parent, lazily computed and cached.
- closest Returns the nearest page matching $query (the find() DSL) walking up from this page, this page included, or null if none does.
- root Returns the root page.
- section Returns the top-level section page.
- depth Returns the depth in the page tree. 0 for root pages.
- childDepth The depth new children are placed at: one below this page, or deeper when its view's `children.path` puts them in folders.
- reorderable Whether this page's children are put in order by hand: its view's `children.sort` is `position`.
- childViews The views an editor may give a new child: the view's `children.views`.
- siblings Returns sibling pages - children of the parent, excluding this page.
- next Returns the next sibling in parent's child order, or null if this is the last.
- prev Returns the previous sibling in parent's child order, or null if this is the first.
- contains True if $other is this page or a descendant of it.
- hasChildren True if this page has any children.
- isActive True if this page is the current request page.
- isOpen True if this page is active or contains the active page.
- child Returns a named child page without checking whether it exists.
- has Whether a child page folder already exists on disk.
Children 6
- new Creates a new child page: mints its uuid and writes a complete, minimal _index.json in one shot, then applies $data via the normal save() path - structural keys (view/hidden/ published/locked) to _index.json, everything else to _data.json (only written if there's content).
- children Queries the registry for direct child pages, ordered by the view's own `children.sort` (index.json), unless $query supplies its own sort= to override it.
- pageLimit The page size: $limit, else the view's `pagination.limit` over the app's. 0 means no limit.
- paginate The current `?page=N` slice of children($query); every child when the limit is 0.
- pageCount How many pages children($query) fill at the page limit; 1 when the limit is 0.
- find Queries the registry for pages within this page's subtree.
Files 5
- fileSourcePath Folder a file() call mirrors source files from.
- publicPath Returns this page's public-mirror directory, e.g. "" -> public/, "blog/post" -> public/blog/post.
- file Resolves a file from this page's own folder.
- image Resolves an image from this page's own folder.
- files This page's files, narrowed by the query DSL over filename, name, extension, type, mime, size, modified and their metadata fields: `files('type=image,sort=filename,limit=4')`.
From Record 12
- assertUnlocked A locked record is protected: it can't be changed or deleted until `locked` is turned off.
- create The one way a record comes into being: under the lock for $key (default: the path) $guard refuses a conflict, then $make builds the record at $path and save() applies $data.
- exists Whether the record is on disk.
- generateUuid The current system uuid format - the single source of truth for tooling that needs to mint or recognize one.
- index The `_index.json` file: uuid, timestamps and the type's structural keys.
- isSiteObject Whether it lives in the site rather than in `phlat/` or an addon.
- keyFor Builds a registry uuid key from a type and identity value, e.g. keyFor('page', $uuid) -> "page:{uuid}".
- name The folder name: the last segment of a page's URL, or a username.
- path The record's folder, with a trailing slash.
- publishedData The canonical _data.json contents, bypassing any draft/preview override (e.g.
- registryKey The registry's uuid key for this object, e.g. "page:{uuid}".
- upload Validates and stores an uploaded file (a raw $_FILES-shape array) into this record's own folder.
Identity
$page->fragment(): bool
Whether this page renders as a bare fragment - its own _index.json wins over the view's default.
Returns bool
phlat/src/Page.php:74
boundClass
staticPage::boundClass(string $name): string
The class App::loadType() looks for when views/{name}/{name}.php declares a bound subclass, e.g. "article" -> ArticlePage.
Parameters (1)
| $name | string |
Returns string
phlat/src/Page.php:87
registryKeyFor
staticPage::registryKeyFor(string $uuid): string
Builds a page registry key from a raw page uuid, for callers without a live Page instance.
Parameters (1)
| $uuid | string |
Returns string
phlat/src/Page.php:107
$page->registryPath(): string
The path stored in the registry for this object.
Returns string
phlat/src/Page.php:112
$page->registryFields(): array
Extra registry columns this object type contributes (e.g. view for pages, role for users).
Returns array
phlat/src/Page.php:117
$page->isSourced(): bool
Whether this page's parent is a PageSource: its content comes from that source, and it is never in the registry.
Returns bool
phlat/src/Page.php:135
Saving
$page->delete(): void
Deletes this page and its persisted subtree - PageCollection::delete() for one page, which has the details.
phlat/src/Page.php:225
$page->move(string $newPath): Page
Moves (or renames) this page and its whole subtree to $newPath, e.g. "blog/2026/post".
Parameters (1)
| $newPath | string |
Returns Page
phlat/src/Page.php:237
Fields
$page->fields(): FieldValueSet
Returns this page's template fields as resolved FieldValue instances.
Returns FieldValueSet
phlat/src/Page.php:287
$page->settingFields(): FieldValueSet
The structural settings an editor sets - published, access, hidden, locked - as FieldValues, so the admin edits them with the same field UI as everything else.
Returns FieldValueSet
phlat/src/Page.php:302
$page->childFields(): FieldValueSet
The fields a new child is made from: its name, unless this view names pages by uuid, and its view when there is a choice.
Returns FieldValueSet
phlat/src/Page.php:335
$page->viewFields(): FieldValueSet
The view a page without one is given: the ones its parent's view takes, or any when it names none.
Returns FieldValueSet
phlat/src/Page.php:350
$page->moveFields(): FieldValueSet
The fields a move is made from: the page's name and its parent, any page whose view takes this one's (or where it is now).
Returns FieldValueSet
phlat/src/Page.php:357
$page->viewConfig(string $key): array
Returns app-level config under $key merged with this view's override of the same key.
Parameters (1)
| $key | string |
Returns array
phlat/src/Page.php:376
Drafts
$page->hasAutosave(): bool
Whether an unsaved draft exists for this page.
Returns bool
phlat/src/Page.php:384
$page->autosave(array $data): void
Persists a draft of the view's fields outside the normal save path - no _index.json, no registry, no git.
Parameters (1)
| $data | array |
phlat/src/Page.php:390
$page->discardAutosave(): void
Clears any pending draft.
phlat/src/Page.php:402
$page->data(): DataFile
The page's content.
Returns DataFile
phlat/src/Page.php:412
$page->withData(array $data): static
This page reading $data as its content, in place of its files and any draft.
Parameters (1)
| $data | array |
Returns static
phlat/src/Page.php:428
Rendering
$page->view(): PageView
The view that renders this page; throws when the page has none.
Returns PageView
phlat/src/Page.php:439
$page->emit(string $event, mixed ...$args): void
Fires `{view}/{event}`, this page's own view as the prefix, so a page can't spell a core event (core names have no slash).
Parameters (2)
| $event | string | |
| ...$args | mixed |
phlat/src/Page.php:453
$page->controller(string $viewName, array $context = []): array
Includes a view's controller file and calls it if it returns a callable; returns the resulting data array.
Parameters (2)
| $viewName | string | |
| $context | array = [] |
Returns array
phlat/src/Page.php:470
$page->render(array $data = [], ?string $block = null): string
Renders the page view, merging in global and view-specific controller data.
Parameters (2)
| $data | array = [] | |
| $block | ?string = null |
Returns string
phlat/src/Page.php:485
$page->cache(): Cache
This page's part of the pages cache.
Returns Cache
phlat/src/Page.php:528
Access
$page->isPublic(): bool
Whether anyone at all may open this page - it and every ancestor published and open to all - whoever is asking.
Returns bool
phlat/src/Page.php:546
$page->isViewable(): bool
Whether the current visitor may open this page.
Returns bool
phlat/src/Page.php:556
$page->assertViewable(): void
Throws what the current visitor gets for a page they may not open: a 404 for an unpublished one (it doesn't admit to existing), a login redirect for a gated page when signed out, a 403 when signed in without the role.
phlat/src/Page.php:567
Routing
$page->remainder(): string
Returns the request path after stripping this page's own URL prefix, trimmed of slashes.
Returns string
phlat/src/Page.php:677
$page->segment(int $n): ?string
Returns the nth segment (1-indexed) of the request sub-path, or null.
Parameters (1)
| $n | int |
Returns ?string
phlat/src/Page.php:694
$page->url(string $path = '', array $query = []): string
Returns the site-relative URL by stripping the pages/ root from the filesystem path.
Parameters (2)
| $path | string = '' | |
| $query | array = [] |
Returns string
phlat/src/Page.php:701
Tree
$page->parents(string $query = ''): PageCollection
Returns all ancestor pages from root to immediate parent, lazily computed and cached.
Parameters (1)
| $query | string = '' |
Returns PageCollection
phlat/src/Page.php:725
$page->depth(): int
Returns the depth in the page tree. 0 for root pages.
Returns int
phlat/src/Page.php:786
$page->childDepth(): int
The depth new children are placed at: one below this page, or deeper when its view's `children.path` puts them in folders.
Returns int
phlat/src/Page.php:792
$page->reorderable(): bool
Whether this page's children are put in order by hand: its view's `children.sort` is `position`.
Returns bool
phlat/src/Page.php:798
$page->childViews(): array
The views an editor may give a new child: the view's `children.views`.
Returns array
phlat/src/Page.php:804
$page->siblings(string $query = '', bool $includeHidden = false): PageCollection
Returns sibling pages - children of the parent, excluding this page.
Parameters (2)
| $query | string = '' | |
| $includeHidden | bool = false |
Returns PageCollection
phlat/src/Page.php:810
$page->next(string $query = '', bool $includeHidden = false): ?Page
Returns the next sibling in parent's child order, or null if this is the last.
Parameters (2)
| $query | string = '' | |
| $includeHidden | bool = false |
Returns ?Page
phlat/src/Page.php:820
$page->prev(string $query = '', bool $includeHidden = false): ?Page
Returns the previous sibling in parent's child order, or null if this is the first.
Parameters (2)
| $query | string = '' | |
| $includeHidden | bool = false |
Returns ?Page
phlat/src/Page.php:826
$page->hasChildren(bool $includeHidden = false): bool
True if this page has any children.
Parameters (1)
| $includeHidden | bool = false |
Returns bool
phlat/src/Page.php:865
$page->isActive(): bool
True if this page is the current request page.
Returns bool
phlat/src/Page.php:871
$page->isOpen(): bool
True if this page is active or contains the active page.
Returns bool
phlat/src/Page.php:877
$page->has(string $slug): bool
Whether a child page folder already exists on disk.
Parameters (1)
| $slug | string |
Returns bool
phlat/src/Page.php:896
Children
$page->new(string $name, array $data = []): Page
Creates a new child page: mints its uuid and writes a complete, minimal _index.json in one shot, then applies $data via the normal save() path - structural keys (view/hidden/ published/locked) to _index.json, everything else to _data.json (only written if there's content).
Parameters (2)
| $name | string | |
| $data | array = [] |
Returns Page
phlat/src/Page.php:913
$page->children(string $query = '', bool $includeHidden = false): PageCollection
Queries the registry for direct child pages, ordered by the view's own `children.sort` (index.json), unless $query supplies its own sort= to override it.
Parameters (2)
| $query | string = '' | |
| $includeHidden | bool = false |
Returns PageCollection
phlat/src/Page.php:988
$page->pageLimit(?int $limit = null): int
The page size: $limit, else the view's `pagination.limit` over the app's. 0 means no limit.
Parameters (1)
| $limit | ?int = null |
Returns int
phlat/src/Page.php:1013
$page->paginate(string $query = '', ?int $limit = null): PageCollection
The current `?page=N` slice of children($query); every child when the limit is 0.
Parameters (2)
| $query | string = '' | |
| $limit | ?int = null |
Returns PageCollection
phlat/src/Page.php:1019
$page->pageCount(string $query = '', ?int $limit = null): int
How many pages children($query) fill at the page limit; 1 when the limit is 0.
Parameters (2)
| $query | string = '' | |
| $limit | ?int = null |
Returns int
phlat/src/Page.php:1031
$page->find(string $query = ''): PageCollection
Queries the registry for pages within this page's subtree.
Parameters (1)
| $query | string = '' |
Returns PageCollection
phlat/src/Page.php:1050
Files
$page->fileSourcePath(): string
Folder a file() call mirrors source files from.
Returns string
phlat/src/Page.php:1065
$page->publicPath(): string
Returns this page's public-mirror directory, e.g. "" -> public/, "blog/post" -> public/blog/post.
Returns string
phlat/src/Page.php:1071
$page->files(string $query = ''): array
This page's files, narrowed by the query DSL over filename, name, extension, type, mime, size, modified and their metadata fields: `files('type=image,sort=filename,limit=4')`.
Parameters (1)
| $query | string = '' |
Returns array
phlat/src/Page.php:1094
From Record
$page->assertUnlocked(): void
A locked record is protected: it can't be changed or deleted until `locked` is turned off.
phlat/src/Data/Record.php:301
create
staticPage::create(App $app, string $path, array $data, callable $make, callable $guard, string $uuid = '', ?string $key = null): T
The one way a record comes into being: under the lock for $key (default: the path) $guard refuses a conflict, then $make builds the record at $path and save() applies $data.
Parameters (7)
| $app | App | |
| $path | string | |
| $data | array | |
| $make | callable | |
| $guard | callable | |
| $uuid | string = '' | |
| $key | ?string = null |
Returns T
phlat/src/Data/Record.php:93
$page->exists(): bool
Whether the record is on disk.
Returns bool
phlat/src/Data/Record.php:214
generateUuid
staticPage::generateUuid(App $app): string
The current system uuid format - the single source of truth for tooling that needs to mint or recognize one.
Parameters (1)
| $app | App |
Returns string
phlat/src/Data/Record.php:79
$page->index(): DataFile
The `_index.json` file: uuid, timestamps and the type's structural keys.
Returns DataFile
phlat/src/Data/Record.php:170
$page->isSiteObject(): bool
Whether it lives in the site rather than in `phlat/` or an addon.
Returns bool
phlat/src/Data/Record.php:164
keyFor
staticPage::keyFor(string $type, string $value): string
Builds a registry uuid key from a type and identity value, e.g. keyFor('page', $uuid) -> "page:{uuid}".
Parameters (2)
| $type | string | |
| $value | string |
Returns string
phlat/src/Data/Record.php:152
$page->name(): string
The folder name: the last segment of a page's URL, or a username.
Returns string
phlat/src/Data/Record.php:242
$page->path(): string
The record's folder, with a trailing slash.
Returns string
phlat/src/Data/Record.php:220
$page->publishedData(): DataFile
The canonical _data.json contents, bypassing any draft/preview override (e.g.
Returns DataFile
phlat/src/Data/Record.php:187
$page->registryKey(): string
The registry's uuid key for this object, e.g. "page:{uuid}".
Returns string
phlat/src/Data/Record.php:158