🦖
[■] codesaur.net 1=[↕]
<?php            /* Raptor Framework */

namespace Web;

use Psr\Http\Message\ResponseInterface;
use codesaur\Http\Application\Application as Base;
use Dashboard\SessionMiddleware;
use Dashboard\Localization\LocalizationMiddleware;

class Application extends Base
{
    public function __construct(ResponseInterface $response)
    {
        parent::__construct($response);

        $this->use(new Template\ExceptionHandler());
        $this->use(new SessionMiddleware(
            fn($path, $method) => \str_starts_with(
                \preg_replace('#^/[a-z]{2}(?=/|$)#', '', $path), '/session/')
        ));
        $this->use(new LocalizationMiddleware(null));
        $this->use(new WebRouter());
        $this->use(new Portal\PortalRouter());
        
    }
}
1:1 ══ APPLICATION.PHP
[■] About
codesaur ecosystem

A PHP framework and packages crafted by a Mongolian developer

The Raptor framework and the standalone PSR-standard packages it is built on - clean architecture, object-oriented code, minimal external dependencies. Open source, MIT licensed.

[■] Compiling
Packages:8
PSR standards:3, 4, 7, 11, 12, 14, 15, 16
PHP version:8.2.1+
Databases:MySQL, PostgreSQL, SQLite
License:MIT
Warnings:0
Errors:0
Success : Press any key

Ecosystem packages

Every package is standalone and installable into any PHP project via Composer. Raptor combines them into a complete framework.

All packages Packagist

[■] Raptor 1=[↕]
codesaur/raptor
Clean architecture object-oriented web development framework
v5.7.2 · ► Details
[■] HTTP Message 2=[↕]
codesaur/http-message
Clean, minimal, object-oriented HTTP Message component (PSR-7)
v3.0.4 · ► Details
[■] Router 3=[↕]
codesaur/router
Lightweight, fast, object-oriented routing component
v6.0.1 · ► Details
[■] HTTP Application 4=[↕]
codesaur/http-application
Lightweight, flexible HTTP Application core compliant with PSR-7 & PSR-15
v7.0.1 · ► Details
[■] DataObject 5=[↕]
codesaur/dataobject
PDO-based data model and table management component (MySQL / PostgreSQL / SQLite)
v10.2.1 · ► Details
[■] Template 6=[↕]
codesaur/template
Self-contained PHP template engine - autoescape, filters, functions, macros, expression parser
v5.0.1 · ► Details
[■] HTTP Client 7=[↕]
codesaur/http-client
Lightweight client component for sending HTTP requests and building/sending MIME email
v2.1.2 · ► Details
[■] Container 8=[↕]
codesaur/container
Lightweight, fast, PSR-11 compliant dependency injection container
v3.2.0 · ► Details

Why Raptor?

Access control, multi-language, CMS, shop, logging, cache - everything a production site needs in one place, with all of the code under your control.

[■] Options

PSR standards

PSR-3, 4, 7, 11, 12, 14, 15, 16 - standards compliance means it plugs into the rest of the PHP world without friction.

Multi-tenant RBAC

Multiple organizations, roles, fine-grained permissions and JWT + Session authentication out of the box.

All the code is yours

Everything outside vendor/ is plain project code - there is no separate "framework core" layer and nothing to override.

MySQL + PostgreSQL

One codebase runs on both drivers. Tables are created automatically from Model classes.

Runs anywhere

VPS, dedicated, cloud or shared hosting - it runs with no extra setup. Method override and body encoding clear even strict cPanel / LiteSpeed / mod_security WAFs.

Mongolian first

Code, comments and docs are in Mongolian and English. Multi-language content management is built in from the ground up.

Architecture

One entry point, as many apps as you need - two by default. A request travels through the middleware chain to the router, controller and template.

[■] RAPTOR PROJECT 2=[↕]
public_html/index.php
 |-- /dashboard/* -> Dashboard\Application   (Admin Panel)
 |    |-- Middleware: MethodOverride, BodyEncoding, Session, JWT,
 |    |               Container, Localization, Settings (CSRF per-route)
 |    |-- Routers (one per feature module)
 |    \-- Controllers -> Templates
 |
 \-- /* -> Web\Application   (Public Website)
      |-- Middleware: Session, Localization, Settings
      |-- WebRouter, PortalRouter
      \-- TemplateController -> Templates

Request flow:
  index.php -> Application -> Middleware chain -> Router match
            -> Controller::action() -> Model (DB)
            -> FileTemplate -> HTML Response
1:1

Quick start

Create an empty database and run one command - all tables and seed data are created automatically on first run.

[■] New Project
Requirements
  • PHP 8.2.1+ (ext-gd, ext-intl)
  • Composer
  • MySQL / PostgreSQL
composer create-project codesaur/raptor my-project
The document root MUST be public_html/ - .env, application/ and vendor/ live above it and stay unreachable by URL.
[■] README.TXT 3=[↕]

Why "Raptor"?

The name honors the remarkable Velociraptor, a dinosaur whose fossils were first unearthed in Mongolia's Gobi Desert (1923). Its author, Narankhuu, is a keen reader on dinosaurs and natural history. codesaur is his own playful name - code + saur - a nod to writing C since 1997: an old-school "coding dinosaur".

Author: Narankhuu (codesaur)
[■] Community

Ask questions, share ideas, report bugs - everything happens in the open on GitHub.