🦖
[■] codesaur/raptor 1=[↕]
codesaur/raptor · v5.7.2

Raptor

Clean architecture object-oriented web development framework

Packagist version Downloads PHP version License Aikido Intel 91/100 PSR-3PSR-4PSR-7PSR-11PSR-12PSR-14PSR-15PSR-16
1:1 ══ composer create-project codesaur/raptor my-project
[■] Raptor

A multi-layered, multi-tenant, full-featured CMS PHP web framework built on PSR standards with RBAC access control. It ships with two apps by default - Web (public website) and Dashboard (admin panel) - and brings the other codesaur ecosystem packages together into one working system.

Features
  • PSR-7/PSR-15 middleware-based architecture
  • JWT + Session authentication
  • Multi-tenant organizations with RBAC
  • Multi-language support (Localization) - one URL prefix per language (/en/...), canonical + hreflang emitted automatically
  • Language-neutral records (code = "*") shown in every language - news, pages and products
  • CMS modules: News, Pages, Files, References, Settings
  • Shop module: Products, cart, multi-product orders, stock tracking (subtracted on confirmation, restored on cancel), Reviews
  • MySQL or PostgreSQL supported
  • SQL file-based database migration system
  • codesaur/template engine (Twig-style syntax, XSS protection through autoescape)
  • OpenAI integration (moedit editor)
  • PSR-3 logging, PSR-14 Event Dispatcher
  • Email (Brevo API, SMTP, PHP mail), Discord webhook notifications
  • SEO: Search, Sitemap, XML Sitemap, RSS feed
  • Spam protection (honeypot, HMAC token, rate limiting, Cloudflare Turnstile)
  • CSRF protection
  • Runs in any environment: VPS, dedicated, cloud or shared hosting - method override and body encoding keep it working even behind a mod_security / LiteSpeed WAF
  • File-based cache (PSR-16), Trash recovery, sidebar badge system

Core classes

ClassPurpose
Dashboard\ApplicationAdmin panel middleware + router registration
Web\ApplicationPublic website middleware + router registration
Dashboard\DatabaseConnectionOpens the PDO connection - MySQL / PostgreSQL chosen in .env
Dashboard\ControllerBase for all controllers: PDO, RBAC, template, log
Dashboard\MethodOverrideMiddlewareRestores PUT/PATCH/DELETE from X-HTTP-Method-Override (WAF)
Dashboard\BodyEncodingMiddlewareDecodes base64-encoded POST bodies (WAF)
Dashboard\ContainerMiddlewareInjects the PSR-11 container and its services into the request
Dashboard\SessionMiddlewareOpens the session and closes it early when no write is needed
Dashboard\Authentication\JWTAuthMiddlewareValidates the JWT and builds the User object
Dashboard\Localization\LocalizationMiddlewareDetermines language and translations
Dashboard\Content\SettingsMiddlewareInjects the system settings into the request
Dashboard\CsrfMiddlewarePer-route CSRF protection
Dashboard\Authentication\UserThe signed-in user: can(), is(), organization scope
Dashboard\RBAC\RBACA user roles and permissions set (cached)
Dashboard\Template\DashboardTraitdashboard.html layout, sidebar and organization switcher
Web\Template\TemplateControllerWeb index.html layout, SEO meta and navigation
Web\Shop\CartSession cart - stores only [product_id => quantity], prices and stock are re-read from the DB
Dashboard\CacheServicePSR-16 file-based cache
Dashboard\Log\LoggerPSR-3 logging into the {table}_log tables
Dashboard\Mail\MailerMailer (Brevo API, SMTP, PHP mail)
Dashboard\Notification\EventDispatcherPSR-14 event dispatcher
Dashboard\Notification\DiscordNotifierDiscord webhook notifications
Dashboard\Migration\MigrationRunnerRuns SQL migration files with a driver-aware statement splitter
Dashboard\Migration\MigrationSecurityScannerFlags writes to sensitive tables and DCL statements
Dashboard\Trash\TrashModelStores deleted records and restores them
Dashboard\File\FileControllerBase logic for file uploads and deletion
Dashboard\Badge\BadgeControllerCounts unseen activity for the sidebar badges
Dashboard\Exception\ErrorHandlerTemplate-based error pages

Quick example

// application/web/WebRouter.php
use codesaur\Router\Router;

class WebRouter extends Router
{
    public function __construct()
    {
        $this->GET('/', [HomeController::class, 'index'])->name('home');
        $this->GET('/page/{slug}', [Content\PageController::class, 'page'])->name('page');
        $this->GET('/news/{slug}', [Content\NewsController::class, 'news'])->name('news');
    }
}

// application/web/HomeController.php
class HomeController extends Template\TemplateController
{
    public function index()
    {
        $recent = (new NewsModel($this->pdo))->getRecentPublished($this->getLanguageCode());
        $this->webTemplate(__DIR__ . '/home.html', ['recent' => $recent])->render();
    }
}

Running tests

composer test
[■] Info
Install
composer create-project codesaur/raptor my-project
Requirements
  • PHP 8.2.1+
  • Composer
  • MySQL / PostgreSQL
  • ext-gd
  • ext-intl
Aikido score 91/100
Checked: 2026-09-10