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
===============

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

v5.1.1(1w ago)042↓83.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 1w ago

READMEChangelog (10)Dependencies (90)Versions (38)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) дээр суурилсан, **олон давхаргат архитектуртай**, **олон байгууллагын (multi-tenant)**, **бүрэн CMS боломжтой** PHP веб фреймворк юм.

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

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

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

- PSR-7/PSR-15 middleware суурьтай архитектур
- JWT + Session нэвтрэлт баталгаажуулалт
- Олон байгууллагын (multi-tenant) RBAC эрхийн удирдлага
- Олон хэл дэмжлэг (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**, **multi-tenant**, **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 ships with two apps by default - **Web** (public website) and **Dashboard** (admin panel) - and a developer can add as many app layers as the project needs. It works together with other packages in the codesaur ecosystem.

### Key Features

[](#key-features)

- PSR-7/PSR-15 middleware-based architecture
- JWT + Session authentication
- Multi-tenant organizations with 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
```

> **Create the empty database yourself** - Raptor never creates the database itself, but all tables and initial seed data ARE auto-created on first run, so never create tables by hand. **Хоосон өгөгдлийн санг developer өөрөө үүсгэнэ** - Raptor санг автоматаар үүсгэдэггүй, харин доторх бүх хүснэгт болон анхны seed өгөгдлийг анх ажиллахдаа автоматаар үүсгэдэг тул хүснэгтүүдийг гараар үүсгэх шаардлагагүй.

### 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 (one per feature module, registered in Application.php)
 |    \-- 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/             # PHP application code (package-by-feature modules)
|   |-- dashboard/           # Admin panel application (also hosts the shared platform modules used by web)
|   \-- web/                 # Public website application
|-- public_html/             # Document root (index.php entry point, assets/)
|-- database/
|   \-- migrations/          # SQL migration files
|-- tests/                   # PHPUnit tests (unit, integration)
|-- docs/                    # Documentation (en/, mn/, conf.example/)
|-- .github/
|   \-- workflows/           # CI code quality checks + auto deploy
|-- logs/                    # Error logs
|-- cache/                   # Framework file cache (PSR-16)
|-- protected/               # Protected files (project uploads outside docroot)
|-- composer.json            # Dependencies
|-- phpunit.xml              # PHPUnit configuration
\-- LICENSE                  # MIT License

```

Each feature module is a single folder bundling its Controller, Model and templates. Module locations and classes are documented per module in `docs/en/README.md` / `docs/mn/README.md` (section 6).

> **`vendor/`-оос бусад бүх директор хөгжүүлэгчийн мэдэлд.** `composer create-project`-оор татсаны дараа `application/`, `public_html/`, `database/`, `tests/`, `docs/`, тохиргооны файлууд бүгд таны төслийн хэсэг болж, хэрэгцээ шаардлагадаа тааруулан бүрэн өөрчлөх, устгах, шинээр бичих боломжтой. Тусдаа "framework core" гэсэн давхарга байхгүй - `application/` дотор `dashboard/`, `web/` гэсэн хоёр апп байх бөгөөд хоёулаа таны төслийн энгийн код. Үндсэн (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. There is no separate "framework core" layer: `application/` holds two apps, `dashboard/` and `web/`, and both are plain project code. 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.

---

Why "Raptor"?
-------------

[](#why-raptor)

Дэлхийд анх удаа **Монголын говиос** (1923) олдсон **Velociraptor** хэмээх гайхалтай динозаврыг бэлэгдэж өгсөн нэр. Зохиогч **Наранхүү** динозавр, байгалийн түүхийг сонирхон уншиж судалдаг хүн. **codesaur** гэдэг нь `code` + `saur` - тэрбээр 1997 оноос C хэл дээр эхлэн програм зохиосон өөрийгөө "хуучин цагийн код бичигч динозавр" хэмээн хөгжилтэйгээр нэрлэсэн билээ.

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".

---

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

[](#acknowledgements)

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

Thanks to [**Gerege Systems LLC**](https://gerege.com/) and its founder **Erdenebat Ts** for their financial support and valuable input during the development of this framework.

---

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 99883763
Web:

**codesaur ecosystem:**

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance98

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

37

Last Release

12d 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

v4.5.2 → v5.0.02026-07-08

### 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 (75 commits)")

---

Tags

psr-7psr-3frameworkrouterpsr-14event dispatchercachepsr-16mailerpsr-15rbacloggerapplicationsmtpmulti-tenanttrashrole-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.9k556.2M21.4k](/packages/laravel-framework)[symfony/symfony

The Symfony PHP framework

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

The Shopware e-commerce core

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

Shopware platform is the core for all Shopware ecommerce products.

595.8M672](/packages/shopware-core)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[doppar/framework

The Doppar Framework

4112.6k14](/packages/doppar-framework)

PHPackages © 2026

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