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: 1

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.0 2026-04-16 21:13 UTC

This package is not auto-updated.

Last update: 2026-04-17 10:48:18 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 .

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:

php -S localhost:8000 -t pub           # without Docker
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

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