tereta/page

Maintainers

Package info

gitlab.com/tereta/library/page

Issues

pkg:composer/tereta/page

Statistics

Installs: 130

Dependents: 1

Suggesters: 0

Stars: 0

1.0.6 2026-05-05 21:22 UTC

This package is auto-updated.

Last update: 2026-05-05 18:29:45 UTC


README

🌐 Русский | English

Table of Contents

Installation

composer require tereta/page

Overview

Page management module. Supports two approaches: storing pages in the database and file-based static pages. If a page is not found in the database, the module looks for it in the file system. The file system allows easy creation and editing of pages without admin panel access, which is convenient for static sections (e.g., "About", "Contacts", etc.). File-based pages also enable maintaining a Git repository for version control and collaboration.

Configuration

The static pages directory is specified in .config.php:

->set('page', Value::factory()->create()
    ->set('location', '%s/resources/pages'))

%s is substituted with the project root directory. Pages are organized by site: resources/pages/{site-identifier}/src/.
The module also supports resources/pages/{site-identifier}/pub/ for public assets.

Static Pages

Pages are placed as .html or .phtml files:

resources/pages/site_identifier/src/
β”œβ”€β”€ index.html          # Home page (/)
β”œβ”€β”€ about.html          # /about
└── about/
    └── team.html       # /about/team

Metadata is specified in an HTML comment at the beginning of the file:

<!--
  @title: Page Title
  @description: Page description
  @status: enabled
  @css: /path/to/style.css
-->
<h1>Page content</h1>

A page is publicly accessible only with @status: enabled. The @status value is also treated as enabled for 1 or true (case-insensitive).
The @css field can be repeated multiple times β€” each path will be added as a separate <link rel="stylesheet">.

After adding a new page, run route registration.
Changes to @title and @description in the file do not update existing routes automatically β€” you need to recreate the route record.

Public Media

Assets can be placed in:

resources/pages/{site-identifier}/pub/

On the first page request the module creates a symlink:

public/media/page/{site-identifier} -> resources/pages/{site-identifier}/pub

Database Pages

The module uses the page table. Key fields:

  • site_id, route_id β€” relations to site and route.
  • identifier β€” unique identifier within the site.
  • status β€” whether the page is published.
  • title, description, content β€” page content.

If a database record exists for the current route_id, it takes precedence over a file.

Routing and Render

  • Route controller alias: page.
  • If a page is not found in DB, the module searches for a file in resources/pages/{site}/src.
  • If the page is missing or status is disabled, a 404 is returned.
  • The page wrapper CSS class is derived from the path (/about/team β†’ about_team).

CLI Commands

./cli.php page:registration <site-identifier>   # Register static pages in routes (route table)

The command scans the file system, extracts metadata, and creates route records for discovered pages.

Author and License

Author: Tereta Alexander
Website: tereta.dev
License: Apache License 2.0. See LICENSE.

 www.β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
     β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
        β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
        β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•”β•β•β•  β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘
        β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘
        β•šβ•β•   β•šβ•β•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•β•β•β•β•β•   β•šβ•β•   β•šβ•β•  β•šβ•β•
                                                      .dev

Copyright (c) 2024-2026 Tereta Alexander