tereta/project

Project skeleton for the Tereta Framework β€” bootstraps a new application with core tereta/* packages, CLI and web entry points, Docker dev environment, and a sample configuration.

Maintainers

Package info

gitlab.com/tereta/library/project

Homepage

Issues

Type:project

pkg:composer/tereta/project

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

1.0.13 2026-04-29 08:18 UTC

This package is auto-updated.

Last update: 2026-04-29 05:43:27 UTC


README

🌐 Русский | English

Table of Contents

Overview

Modular, attribute-driven PHP framework with web and CLI runtimes. It allows developers to build applications with minimal configuration, leveraging the powerful features of PHP 8.4+ and extending functionality through modules and attributes. Best suited for commercial projects where extensibility, flexibility and cost-effective development matter.

Key responsibilities:

  • Bootstrap web and CLI runtime flows
  • Load runtime configuration from .config.php (can be moved outside the web root via require)
  • Wire core modules (routing, DB, customer, theme, admin packages)
  • Provide extension points via module classes and attributes

Quick Start

1. Create a new project from the skeleton:

composer create-project tereta/project .
composer server
php ./cli

This bootstraps a fresh project with all tereta/* core packages installed into vendor/, entry points (cli.php, pub/index.php), and a sample configuration.

Alternatively, for framework contributors, clone the monorepo:

git clone https://gitlab.com/tereta/framework.git .
composer install

2. Configure the project:

cp .config.sample.php .config.php
chmod -R 755 var/

Edit .config.php to set database DSN, SMTP credentials, reCAPTCHA keys, etc.

3. Run locally:

composer server          # without Docker, using built-in PHP server
composer docker:up       # with Docker

composer setup performs the full bootstrap in one go (install, Docker up, DB schema refresh, theme install & build):

composer setup

4. Build the theme separately (if needed):

composer theme:install
composer theme:build

5. On macOS with Docker, generate local SSL certificates for dev domains:

composer docker:certificate -- domain.dev domain.com

6. Run tests and static analysis:

composer test

Project Structure

The skeleton is intentionally small β€” framework modules live in vendor/tereta/* and are installed via Composer. Your application code lives in src/.

.
β”œβ”€β”€ cli.php                 # CLI entry point
β”œβ”€β”€ pub/
β”‚   β”œβ”€β”€ index.php           # Web application entry point
β”‚   β”œβ”€β”€ media/              # User-uploaded media (gitignored)
β”‚   β”œβ”€β”€ theme/              # Built theme assets (gitignored)
β”‚   └── site.webmanifest
β”œβ”€β”€ src/                    # Your application code (PSR-4 autoloaded from `/`)
β”œβ”€β”€ packages/               # Local path-repo packages (optional, gitignored by default)
β”œβ”€β”€ resources/              # Project resources (pages, templates) β€” gitignored
β”œβ”€β”€ theme/                  # Theme sources (SCSS, JS) β€” see tereta/theme
β”œβ”€β”€ dev/
β”‚   β”œβ”€β”€ docker/             # Docker Compose + tools (certificates, nginx, php-fpm)
β”‚   β”œβ”€β”€ cicd/               # CI/CD helpers
β”‚   β”œβ”€β”€ git/                # Git hooks and scripts
β”‚   └── phpstan/            # PHPStan bootstrap
β”œβ”€β”€ docs/                   # Documentation (RU translation lives here)
β”œβ”€β”€ var/                    # Runtime state: cache, logs (gitignored, must be writable)
β”œβ”€β”€ vendor/                 # Composer dependencies (incl. tereta/* core modules)
β”œβ”€β”€ .config.sample.php      # Configuration template β€” copy to .config.php
β”œβ”€β”€ .config.web.php         # Web-only overrides
β”œβ”€β”€ composer.json
└── README.md

Core framework modules (installed via Composer under vendor/tereta/):

PackageResponsibility
tereta/applicationWeb and CLI runtime bootstrap
tereta/cacheCaching services and adapters
tereta/cliCLI commands, input/output
tereta/configConfiguration pool
tereta/coreShared models, traits, interfaces
tereta/customerAuth, registration, account flows
tereta/dbDB abstraction, models, schemas
tereta/diDependency injection container
tereta/emailEmail transports and factory
tereta/fsFile and directory utilities
tereta/loggerLogging channels
tereta/markdownMarkdown processing
tereta/pagePage controllers
tereta/recaptchareCAPTCHA validation
tereta/routeRouting, requests, responses
tereta/securityCSRF, security headers
tereta/sessionSession management
tereta/supportSupport pages
tereta/themeRendering, theme DI, SCSS build
tereta/threadThreads/discussions
tereta/utilitiesMisc helpers

Environment and Requirements

Required:

  • PHP 8.4+
  • Extensions: ctype, dom, iconv, mbstring, pdo, fileinfo, curl
  • Write access to var/

Optional:

  • Node.js + npm (theme build)
  • Docker Compose (local development environment)
  • MySQL or PostgreSQL (for DB)

Common issues:

  • Configuration file not found β€” create .config.php from .config.sample.php
  • DB connection error β€” check pdo.dsn and credentials in .config.php
  • Static files not loading with built-in server β€” run with -t pub exactly as shown above

Tests

Run all checks (PHPCS + PHPStan + PHPUnit):

composer test

Individually:

composer phpcs      # Code style (PSR-12)
composer phpstan    # Static analysis (level 7)
composer phpunit    # Unit tests

Tests are located in:

src/*/*/Tests
packages/*/src/Tests

Deploy and Production

(CI/CD)

CI/CD is configured via GitLab CI (.gitlab-ci.yml). The pipeline includes:

Test stage:

  • lint β€” code style check (PHPCS) and static analysis (PHPStan)
  • unit β€” theme build and PHPUnit execution

Deploy stage:

  • dev branch β€” automatic deploy to development environment
  • main branch β€” manual deploy to production

Deploy is performed via SSH. Required CI/CD variables:

  • SSH_PRIVATE_KEY β€” private key (file)
  • SSH_HOST, SSH_PORT, SSH_USER β€” connection parameters
  • SSH_DIRECTORY β€” project directory on the server

Local GitLab Runner

dev/docker/docker-compose.yml includes a gitlab-runner service for executing CI jobs locally. Registration is automated via a Composer script.

1. Set at minimum in dev/docker/.env:

GITLAB_RUNNER_TOKEN=glrt-xxxxxxxxxxxxxxxxxxxx

Optional variables (with defaults):

VariableDefaultPurpose
GITLAB_URLhttps://gitlab.com/GitLab instance URL
GITLAB_RUNNER_NAMElocal-docker-runnerRunner name
GITLAB_RUNNER_TAGSlocal,dockerTags
GITLAB_RUNNER_IMAGEdebian:trixie-slimDefault image for jobs
GITLAB_RUNNER_CONCURRENT4Max concurrent jobs (global)
GITLAB_RUNNER_LIMIT4Job limit for this runner

2. Start the container and register:

composer docker:up              # bring up containers, including gitlab-runner
composer docler:runner:update   # register runner with GitLab

The script patches concurrent = N in /etc/gitlab-runner/config.toml and restarts the container.

Security: the container mounts /var/run/docker.sock β€” this grants full access to the host Docker daemon. Use only for local development.

Production checklist:

  • PHP 8.4+ on the server
  • composer install --no-dev for production
  • Theme built (composer theme:build)
  • var/ writable by the web server

Author and License

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

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

Copyright (c) 2024-2026 Tereta Alexander