<?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
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.
| 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 |
Ecosystem packages
Every package is standalone and installable into any PHP project via Composer. Raptor combines them into a complete framework.
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.
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.
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 Response1:1
Quick start
Create an empty database and run one command - all tables and seed data are created automatically on first run.
- 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.
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)Ask questions, share ideas, report bugs - everything happens in the open on GitHub.