Search by

tereta / page

tereta

The page content package for the tereta/application framework.It registers html files as pages, reads their metadata from the header comment, and serves the content from a file or from the database.

0.0.11 2026-10-11 18:51 UTC

This package is not auto-updated.

Last update: 2026-10-17 13:47:21 UTC


README

🌐 English | Русский | Π£ΠΊΡ€Π°Ρ—Π½ΡΡŒΠΊΠ°

Page package for the tereta/application framework. It turns html files into site pages and shows them by their address.

Requirements

PHP 8.2+, tereta/application.

Installation

composer require tereta/application-page

After installation, run the database migration of the application, so the page table is created.

Configuration

Tell the application where the pages of each site live. %s is replaced with the site name:

use Tereta\ApplicationPage\Context\Config as PageConfig;

return [
    'page' => (new PageConfig())->set('directory', ROOT_DIRECTORY . '/resources/pages/%s'),
];

For the site base the pages are taken from resources/pages/base/html.

Page file

A page is an html file. At the top of the file there is a comment with the page settings:

<!--
@path /about
@title About us
@description A few words about our company
@css css/about.css
-->
<h1>About us</h1>
<p>We make websites.</p>
  • @path - the address of the page, it is required.
  • @identifier - the name of the page. If it is not set, the file name is used: about/team.html becomes about/team.
  • @domain - the domain of the page, if the site has several domains.
  • @css and @class - styles and css classes for the page. They can be repeated.
  • Any other tag, like @title, is passed to the template as is.

Write {site} in the text to insert the address of the site:

<a href="{site}/contacts">Contacts</a>

Register pages

New files must be registered once. Run the command with the site name:

php bin/console.php page:register base

Run it again after you add new files. Pages that already exist are not created twice.

Pictures and styles

Files next to the html folder are available by the address /media/page/<site>/<file>. For example, resources/pages/base/images/logo.png opens as /media/page/base/images/logo.png.

Supported files: css, js, png, jpg, jpeg, gif, webp, svg.

License

Apache License 2.0