Tereta/Route Module

Overview

Routing module. Manages sites, domains, and routes. Supports multi-site architecture — a single project can serve multiple sites on different domains.

Multi-Site Support

The project supports multiple sites, each with its own domains:

  • Site — a logical unit with a name and identifier
  • Domain — host binding to a site (supports port, path, HTTP/HTTPS)
A single site can have multiple domains (e.g., example.com and admin.example.com/panel).

Routing

Routes are resolved through a priority chain:

  1. Controller attributes — routes declared via #[ControllerAttribute] (see Application module)
  2. Database — routes from the route table
During request processing, the domain, site, and route are determined, then the request is passed to the corresponding controller.

CLI Commands

Site management:

./cli.php route:site list                                    # List sites
./cli.php route:site create <identifier> "<name>" "<url>"    # Create a site
./cli.php route:site delete <identifier>                     # Delete a site

Example:

./cli.php route:site create default "My Site" "https://example.com"

Author and License

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

 www.████████╗███████╗██████╗ ███████╗████████╗ █████╗
     ╚══██╔══╝██╔════╝██╔══██╗██╔════╝╚══██╔══╝██╔══██╗
        ██║   █████╗  ██████╔╝█████╗     ██║   ███████║
        ██║   ██╔══╝  ██╔══██╗██╔══╝     ██║   ██╔══██║
        ██║   ███████╗██║  ██║███████╗   ██║   ██║  ██║
        ╚═╝   ╚══════╝╚═╝  ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝
                                                      .dev

Copyright (c) 2024-2026 Tereta Alexander