PHPackages                             codesaur/raptor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. codesaur/raptor

ActiveProject[Framework](/categories/framework)

codesaur/raptor
===============

Цэвэр архитектуртай объект хандалттай веб хөгжүүлэлтийн фреймворк

v4.4.1(6d ago)031↓92.3%MITPHPCI passing

Since Feb 25Pushed 1w agoCompare

[ Source](https://github.com/codesaur-php/Raptor)[ Packagist](https://packagist.org/packages/codesaur/raptor)[ Docs](https://codesaur.net)[ RSS](/packages/codesaur-raptor/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (54)Versions (32)Used By (0)

🦖 codesaur/raptor
=================

[](#-codesaurraptor)

[![PHP Version](https://camo.githubusercontent.com/1015683ef28e870620edc19b6e22b456c0dc170c260fa4645905e93438f607a6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322e312d3737374242342e7376673f6c6f676f3d706870)](https://www.php.net/)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Цэвэр архитектуртай объект хандалттай веб хөгжүүлэлтийн фреймворк
Clean architecture object-oriented web development framework

---

Агуулга / Table of Contents
---------------------------

[](#агуулга--table-of-contents)

1. [Монгол](#1-%D0%BC%D0%BE%D0%BD%D0%B3%D0%BE%D0%BB-%D1%82%D0%B0%D0%B9%D0%BB%D0%B1%D0%B0%D1%80) | 2. [English](#2-english-description) | 3. [Getting Started](#3-getting-started)

---

1. Монгол тайлбар
-----------------

[](#1-монгол-тайлбар)

`codesaur/raptor` нь PSR стандартууд (PSR-3, PSR-4, PSR-7, PSR-11, PSR-12, PSR-14, PSR-15, PSR-16) дээр суурилсан, **олон давхаргат архитектуртай**, **бүрэн CMS боломжтой** PHP веб фреймворк юм.

Фреймворк нь **Web** (нийтийн вебсайт) болон **Dashboard** (админ панель) гэсэн хоёр давхаргад хуваагдан ажилладаг бөгөөд codesaur экосистемийн бусад packages-тэй хамтран ажиллана.

### Гол боломжууд

[](#гол-боломжууд)

- PSR-7/PSR-15 middleware суурьтай архитектур
- JWT + Session нэвтрэлт баталгаажуулалт
- RBAC (Role-Based Access Control) эрхийн удирдлага
- Олон хэл дэмжлэг (Localization)
- CMS модулиуд: Мэдээ, Хуудас, Файл, Лавлах, Тохиргоо
- Дэлгүүр модуль: Бүтээгдэхүүн, Захиалга, Үнэлгээ (e-commerce)
- MySQL, PostgreSQL алийг нь ч дэмжинэ
- SQL файл суурьтай өгөгдлийн сангийн migration систем
- codesaur/template engine
- OpenAI интеграци (moedit editor)
- Зураг optimize хийх (GD)
- PSR-3 лог систем
- И-мэйл (Brevo API, SMTP, PHP mail), Discord webhook мэдэгдэл
- PSR-14 Event Dispatcher систем
- SEO: Хайлт, Sitemap, XML Sitemap, RSS feed
- Спам хамгаалалт (honeypot, HMAC token, rate limiting, Cloudflare Turnstile)
- CSRF хамгаалалт (CsrfMiddleware, csrfFetch)
- Shared hosting / WAF тохиромж (cPanel/LiteSpeed/mod\_security): HTTP method override, body encoding
- File-based DB cache (PSR-16 SimpleCache) - автомат invalidation-тэй
- Устгасан бичлэгийг сэргээх Trash систем
- Dashboard sidebar badge систем (уншаагүй үйлдлийн тоолуур)
- Админ имэйл мэдэгдэл: мессеж, захиалга, сэтгэгдэл, үнэлгээ (суваг тус бүрд тохируулах)

### Дэлгэрэнгүй мэдээлэл

[](#дэлгэрэнгүй-мэдээлэл)

- [Бүрэн танилцуулга](docs/mn/README.md) - Суулгах, тохируулах, архитектур, хэрэглээ
- [API тайлбар](docs/mn/api.md) - Бүх модуль, класс, методуудын дэлгэрэнгүй

---

2. English Description
----------------------

[](#2-english-description)

`codesaur/raptor` is a **multi-layered**, **full-featured CMS** PHP web framework built on PSR standards (PSR-3, PSR-4, PSR-7, PSR-11, PSR-12, PSR-14, PSR-15, PSR-16).

The framework operates in two layers - **Web** (public website) and **Dashboard** (admin panel) - and works together with other packages in the codesaur ecosystem.

### Key Features

[](#key-features)

- PSR-7/PSR-15 middleware-based architecture
- JWT + Session authentication
- RBAC (Role-Based Access Control)
- Multi-language support (Localization)
- CMS modules: News, Pages, Files, References, Settings
- Shop module: Products, Orders, Reviews (e-commerce)
- MySQL or PostgreSQL supported
- SQL file-based database migration system
- codesaur/template engine
- OpenAI integration (moedit editor)
- Image optimization (GD)
- PSR-3 logging system
- Email (Brevo API, SMTP, PHP mail), Discord webhook notifications
- PSR-14 Event Dispatcher system
- SEO: Search, Sitemap, XML Sitemap, RSS feed
- Spam protection (honeypot, HMAC token, rate limiting, Cloudflare Turnstile)
- CSRF protection (CsrfMiddleware, csrfFetch)
- Shared hosting / WAF compatibility (cPanel/LiteSpeed/mod\_security): HTTP method override, body encoding
- File-based DB cache (PSR-16 SimpleCache) with auto-invalidation
- Trash system for deleted records recovery
- Dashboard sidebar badge system (unseen activity counters)
- Admin email notifications for contact messages, orders, comments, reviews (per-channel config)

### Documentation

[](#documentation)

- [Full Documentation](docs/en/README.md) - Installation, configuration, architecture, usage
- [API Reference](docs/en/api.md) - All modules, classes, and methods

---

3. Getting Started
------------------

[](#3-getting-started)

### Requirements

[](#requirements)

- PHP **8.2.1+**
- Composer
- MySQL or PostgreSQL
- PHP extensions: `ext-gd`, `ext-intl`

### Installation

[](#installation)

```
composer create-project codesaur/raptor my-project
```

### Configuration

[](#configuration)

`composer create-project` ашигласан бол `.env` файл автоматаар үүсэх бөгөөд `RAPTOR_JWT_SECRET` мөн автоматаар generate хийгдэнэ. Хэрэв `.env` үүсээгүй бол гараар хуулна:

If you used `composer create-project`, the `.env` file is auto-created and `RAPTOR_JWT_SECRET` is auto-generated. If `.env` was not created, copy it manually:

```
cp docs/conf.example/.env.example .env
```

Server configuration examples / Серверийн тохиргооны жишээ: [`docs/conf.example/`](docs/conf.example/)

> **Document root MUST be `public_html/`** (never the project root) - everything else (`.env`, `application/`, `protected/`, `vendor/`, ...) lives above it and must stay unreachable by URL. This is the primary, server-agnostic protection on both Apache and Nginx. **Document root заавал `public_html/` байх ёстой** (project root биш) - бусад бүх зүйл (`.env`, `application/`, `protected/`, `vendor/`, ...) түүнээс дээр байрладаг тул URL-аар хүршгүй байх ёстой. Энэ нь Apache, Nginx хоёуланд server-аас үл хамаарах үндсэн хамгаалалт.

Гол тохиргоонууд / Key configuration:

```
# Environment (development / production)
CODESAUR_APP_ENV=development

# Database
RAPTOR_DB_HOST=localhost
RAPTOR_DB_NAME=raptor
RAPTOR_DB_USERNAME=root
RAPTOR_DB_PASSWORD=

# JWT (secret is auto-generated)
RAPTOR_JWT_ALGORITHM=HS256
RAPTOR_JWT_LIFETIME=2592000

# WAF compatibility (mod_security)
RAPTOR_WAF_BODY_ENCODING=true
```

### Quick Architecture

[](#quick-architecture)

```
public_html/index.php
 |-- /dashboard/* -> Dashboard\Application (Admin Panel)
 |    |-- Middleware stack (MethodOverride, BodyEncoding, Session, JWT, Container, Localization, Settings; CSRF per-route)
 |    |-- Routers (Login, Users, Organization, RBAC, Content, Logs, Shop, Development, Migration)
 |    \-- Controllers -> Templates
 |
 \-- /* -> Web\Application (Public Website)
      |-- Middleware stack (Session, Localization, Settings)
      |-- WebRouter (/, /page/{id}, /news/{id}, /contact, /language/{code})
      \-- TemplateController -> Templates

```

**Request Flow:** index.php -&gt; Application -&gt; Middleware chain -&gt; Router match -&gt; Controller -&gt; Response

### Directory Structure

[](#directory-structure)

```
raptor/
|-- application/
|   |-- raptor/              # Core framework (Controllers, Models, Middleware)
|   |   |-- Application.php, Controller.php           # Dashboard app + base controller
|   |   |-- DatabaseConnection.php                    # Single PDO factory (driver from RAPTOR_DB_DRIVER)
|   |   |-- SessionMiddleware.php, ContainerMiddleware.php, CsrfMiddleware.php  # PSR-15 middleware
|   |   |-- MethodOverrideMiddleware.php, BodyEncodingMiddleware.php   # Shared hosting / WAF compatibility
|   |   |-- CacheService.php, SpamProtectionTrait.php # Cache + spam helpers
|   |   |-- authentication/  # Login, JWT, Session
|   |   |-- content/         # CMS (files, messages, news, pages, references, settings, AI)
|   |   |-- localization/    # Languages & translations
|   |   |-- organization/    # Organization management
|   |   |-- rbac/            # Roles & permissions
|   |   |-- user/            # User management
|   |   |-- template/        # Dashboard UI, menu, badges
|   |   |-- exception/       # Exception handler
|   |   |-- log/             # Logging
|   |   |-- mail/            # Email (Brevo API, SMTP, PHP mail)
|   |   |-- notification/    # PSR-14 events, Discord webhook notifications
|   |   |-- trash/           # Trash system for deleted records recovery
|   |   |-- development/     # Dev request tracking
|   |   \-- migration/       # Database migration system
|   |-- dashboard/           # Dashboard application
|   |   |-- home/            # Dashboard home
|   |   |-- shop/            # Shop module (Products, Orders, Reviews)
|   |   \-- manual/          # Manual pages
|   \-- web/                 # Public website application
|       |-- WebRouter.php    # Web routes
|       |-- content/         # Pages, News
|       |-- shop/            # Products, Orders, Reviews
|       |-- service/         # Search, Sitemap, RSS, Contact
|       \-- template/        # Web layout, exception handler
|-- public_html/             # Document root
|   |-- index.php            # Entry point
|   |-- .htaccess            # Apache URL rewrite
|   |-- robots.txt           # Search engine bot rules
|   \-- assets/              # CSS, JS (dashboard, moedit, motable etc)
|-- database/
|   \-- migrations/          # SQL migration files
|-- tests/                   # PHPUnit tests (unit, integration)
|-- docs/
|   |-- conf.example/        # Server config examples
|   |-- en/                  # English documentation
|   \-- mn/                  # Mongolian documentation
|-- .github/
|   \-- workflows/
|       |-- ci.yml           # CI code quality checks (push, PR)
|       \-- deploy.yml       # Auto deploy (FTP / SSH / Windows Server)
|-- logs/                    # Error logs
|-- protected/               # Protected files (uploads, cache)
|-- .env.testing             # Test environment variables
|-- composer.json            # Dependencies
|-- phpunit.xml              # PHPUnit configuration
\-- LICENSE                  # MIT License

```

> **`vendor/`-оос бусад бүх директор хөгжүүлэгчийн мэдэлд.** `composer create-project`-оор татсаны дараа `application/`, `public_html/`, `database/`, `tests/`, `docs/`, тохиргооны файлууд бүгд таны төслийн хэсэг болж, хэрэгцээ шаардлагадаа тааруулан бүрэн өөрчлөх, устгах, шинээр бичих боломжтой - `application/raptor/` core хүртэл үүнд хамаарна. Үндсэн (default) codebase нь хөгжүүлэгчийн нийтлэг хэрэгцээг хангасан суурь тул өөрийн нарийвчилсан хэрэгцээ шаардлагаа кодод шууд шингээгээрэй. Зөвхөн `vendor/*` packages нь Composer-ээр удирдагдах dependency тул гар хүрэхгүй (`composer update`-ээр шинэчилнэ).
>
> **Everything outside `vendor/` is yours.** After `composer create-project`, `application/`, `public_html/`, `database/`, `tests/`, `docs/` and the config files all become part of your project - freely modify, delete, or rewrite them to fit your needs, including the `raptor/` core itself. The default codebase is a baseline covering a developer's common needs, so adapt the code directly to your own detailed requirements. Only the `vendor/*` packages are Composer-managed dependencies (updated via `composer update`); leave those untouched.

### Testing / Тест

[](#testing--тест)

PHPUnit 11 суурьтай unit болон integration тестүүдтэй. Includes PHPUnit 11 test suite with unit and integration tests.

```
composer test              # Бүх тест / All tests
composer test:unit         # Unit тест / Unit tests only
composer test:integration  # Integration тест / Integration tests only
```

Integration тест `.env.testing` файлын тохиргоог ашиглан тусдаа test database дээр ажиллана. Тест бүр transaction дотор ажиллаж, дуусахад rollback хийнэ.

Integration tests use `.env.testing` config with a separate test database. Each test runs in a transaction and rolls back on teardown.

---

History
-------

[](#history)

> **Note:** This package is the successor of `codesaur/indodaptor` (500+ installs), which has been removed from Packagist. A new package `codesaur/raptor` was created with a full code refactor, as the name "Indoraptor" is a trademark of Universal Pictures.

---

Did You Know?
-------------

[](#did-you-know)

**Velociraptor** (/vɪˈlɒsɪræptər/ - Латинаар "swift seizer" буюу "хурдан баригч") нь Cretaceous галавын сүүл үе буюу ойролцоогоор 75-71 сая жилийн өмнө амьдарч байсан dromaeosaurid theropod үлэг гүрвэлийн төрөл юм. Одоогоор хоёр зүйлийг хүлээн зөвшөөрсөн бөгөөд *V. mongoliensis* энэ зүйлийн олдворуудыг **Монгол** улсаас олсон байдаг. Хоёр дахь зүйл *V. osmolskae*-г 2008 онд Өвөр Монголоос олдсон гавлын материалаар нэрлэсэн.

Acknowledgements
----------------

[](#acknowledgements)

Энэ фреймворкийг хөгжүүлэхэд [**Gerege Systems LLC**](https://gerege.com/) ивээн тэтгэж, компанийн үүсгэн байгуулагч **Ц.Эрдэнэбат** багш удирдан зааварлаж чиглүүлсэн билээ.

This framework was developed with the sponsorship of [**Gerege Systems LLC**](https://gerege.com/) and under the guidance of **Erdenebat Ts**, founder of Gerege Systems.

---

Changelog
---------

[](#changelog)

- [CHANGELOG.md](CHANGELOG.md) - Version history

Community
---------

[](#community)

- [Discussions](https://github.com/orgs/codesaur-php/discussions) - Ask questions, share ideas, get help

Contributing &amp; Security
---------------------------

[](#contributing--security)

- [Contributing Guide](.github/CONTRIBUTING.md)
- [Security Policy](.github/SECURITY.md)

License
-------

[](#license)

This project is licensed under the MIT License.

Author
------

[](#author)

**Narankhuu**
Email:
Phone: +976 99000287
Web:

**codesaur ecosystem:**

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance94

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

31

Last Release

6d ago

Major Versions

v1.9.1 → v2.0.02026-03-18

v2.2.0 → v3.0.02026-04-28

v3.1.0 → v4.0.02026-06-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4127594?v=4)[Наранхүү Н](/maintainers/codesaur)[@codesaur](https://github.com/codesaur)

---

Top Contributors

[![codesaur](https://avatars.githubusercontent.com/u/4127594?v=4)](https://github.com/codesaur "codesaur (62 commits)")

---

Tags

psr-7psr-3frameworkrouterpsr-14event dispatchercachepsr-16mailerpsr-15rbacloggerapplicationsmtptrashrole-based-access-controlcodesaurmongolmongolianarankhuucodenкодзаврнаранхүүкоденhttp applicationserver request handlerraptorфреймворкхэрэглэгчийн эрхийн зохицуулалтпротоколхогийн савкэши-мэйл

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codesaur-raptor/health.svg)

```
[![Health](https://phpackages.com/badges/codesaur-raptor/health.svg)](https://phpackages.com/packages/codesaur-raptor)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.0k](/packages/laravel-framework)[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M573](/packages/shopware-core)[doppar/framework

The Doppar Framework

4012.4k14](/packages/doppar-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
