PHPackages                             rudra/framework - 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. rudra/framework

ActiveLibrary[Framework](/categories/framework)

rudra/framework
===============

Rudra framework

v26.7(5d ago)1134MPL-2.0PHPPHP ^8.3CI failing

Since Jun 29Pushed 5d ago2 watchersCompare

[ Source](https://github.com/Jagepard/Rudra-Framework)[ Packagist](https://packagist.org/packages/rudra/framework)[ RSS](/packages/rudra-framework/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (38)Versions (7)Used By (0)

[![Maintainability](https://camo.githubusercontent.com/357cedbd9bf1f7b44724d392feaa0b046ac028a4ce0742ac03d3e5735beee791/68747470733a2f2f716c74792e73682f6261646765732f35613236353638652d306433382d346461662d383737322d3030363339653238396565322f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/Jagepard/projects/Rudra-Framework)[![CodeFactor](https://camo.githubusercontent.com/1f320c130e3e01235d5812a398171b5730222626db0096eb967e2afd4265d964/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f6a616765706172642f72756472612d6672616d65776f726b2f6261646765)](https://www.codefactor.io/repository/github/jagepard/rudra-framework)[![PHP Version](https://camo.githubusercontent.com/89899a77bdce65fc4c3d3423dfacff9c6461066a0b5354dc18d7721c23ba596e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c75652e737667)](https://php.net)[![License](https://camo.githubusercontent.com/66798e2da7a60cdcc10956ed4ea09591037a34b43985bedf81e4b2e3427d640f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d504c2d2d322e302d677265656e2e737667)](./LICENSE)

Rudra Framework
===============

[](#rudra-framework)

A lightweight, transparent PHP framework built on the principles of simplicity and clarity.

**~15 MB** · Lightweight Query Builder · No hidden dependencies · No magic · PHP 8.3 Attributes · Porto Architecture

Philosophy
----------

[](#philosophy)

Rudra follows the **KISS principle** — every tool is visible, every dependency is explicit, and every layer does exactly one thing. No "magic" happens behind the scenes: if you see it in the code, that's all there is.

- **Transparency** — no hidden behavior, no implicit side effects
- **Simplicity** — minimal surface area, easy to learn and extend
- **Explicit over implicit** — dependencies are declared, not guessed
- **Modern PHP** — built from the ground up on PHP 8.3+ features (attributes, typed constants, fibers)

Who is this for?
----------------

[](#who-is-this-for)

Rudra is built for developers who:

- **Prefer explicit code over framework magic** — you want to see exactly what SQL is executed, what routes are registered, and what dependencies are injected
- **Value cognitive clarity** — you need a framework that stays out of your way and doesn't require memorizing hidden conventions
- **Work on small-to-medium projects** — you want structure and best practices without the overhead of enterprise-grade frameworks
- **Want full control** — you believe that understanding your tools is more important than having hundreds of features out of the box

If you're looking for a batteries-included framework with built-in ORM, pre-configured queue workers, and ready-made broadcast drivers — Rudra is not for you.
If you want a lightweight, transparent foundation with simple primitives that you can extend exactly as needed — you're in the right place.

Installation
------------

[](#installation)

### Via Composer (stable)

[](#via-composer-stable)

```
composer create-project --prefer-dist rudra/framework newapp
cd newapp
```

### Via Composer (dev)

[](#via-composer-dev)

```
composer create-project --prefer-dist --stability=dev rudra/framework newapp
cd newapp
```

### Via Git + DDEV (full environment)

[](#via-git--ddev-full-environment)

The fastest way to get a fully working local environment — containers, dependencies, SSL, and database included:

```
git clone git@github.com:Jagepard/Rudra-Framework.git
cd Rudra-Framework
ddev start   # Start containers, install deps, set up SSL & DB
ddev launch  # Open the site in your browser
```

Quick Start
-----------

[](#quick-start)

Run the built-in development server:

```
php rudra serve
```

Then open  in your browser.

📦 Ecosystem Components
----------------------

[](#-ecosystem-components)

Rudra is built on a **modular component architecture**. Each component is a standalone Composer package — use only what you need, or install everything via `rudra/framework`.

ComponentDescriptionPackage📦 **[Container](https://github.com/Jagepard/Rudra-Container)**DI container with 5 binding patterns (string, object, factory string, factory object, closure)`rudra/container`🧭 **[Router](https://github.com/Jagepard/Rudra-Router)**HTTP router with PHP 8 attributes, middleware pipeline, REST resources, method spoofing`rudra/router`🎯 **[Controller](https://github.com/Jagepard/Rudra-Controller)**MVC controller abstraction with lifecycle hooks (`init`, `before`, `after`)`rudra/controller`💾 **[Model](https://github.com/Jagepard/Rudra-Model)**Lightweight Query Builder + Repository pattern (not a heavy ORM)`rudra/model`🔐 **[Auth](https://github.com/Jagepard/Rudra-Auth)**Authentication, session management, RBAC, "Remember Me"`rudra/auth`🔗 **[OAuthClient](https://github.com/Jagepard/Rudra-OAuthClient)**OAuth 2.0 client (Yandex, VK, custom providers)`rudra/oauth-client`🎧 **[EventDispatcher](https://github.com/Jagepard/Rudra-EventDispatcher)**Events system with Listeners (pub/sub) and Observers (stateless notifications)`rudra/event-dispatcher`✅ **[Validation](https://github.com/Jagepard/Rudra-Validation)**Fluent validation with CSRF, sanitization, custom rules, field aliases`rudra/validation`🖼️ **[View](https://github.com/Jagepard/Rudra-View)**Template engine (PHP + Twig support) with file-based caching`rudra/view`🛡️ **[Exception](https://github.com/Jagepard/Rudra-Exception)**HTTP error handling with custom error pages and DebugBar integration`rudra/exception`🔀 **[Redirect](https://github.com/Jagepard/Rudra-Redirect)**HTTP redirection with status codes (1xx-5xx)`rudra/redirect`📄 **[Pagination](https://github.com/Jagepard/Rudra-Pagination)**SQL OFFSET/LIMIT calculator with page links generator`rudra/pagination`📜 **[Annotation](https://github.com/Jagepard/Rudra-Annotation)**Metadata reader for PHP 8 attributes + legacy docblock annotations`rudra/annotation`🖥️ **[Cli](https://github.com/Jagepard/Rudra-Cli)**CLI component with command routing`rudra/cli`📝 **[Docs](https://github.com/Jagepard/Rudra-Documentation-Collector)**Auto-generates Markdown API documentation from source code`rudra/docs`🔑 Key Features in Action
------------------------

[](#-key-features-in-action)

### 🔐 Authentication &amp; RBAC

[](#-authentication--rbac)

```
use Rudra\Auth\AuthFacade as Auth;

// Registration
$user = [
    "email"    => "user@email.com",
    "password" => Auth::bcrypt("password")
];

// Authentication (plain password vs hash from DB)
Auth::authentication($user, "password", ["admin/dashboard", "login"]);

// Authorization check (redirects to 'login' if not authenticated)
if (!Auth::authorization(null, "login")) {
    exit;
}

// Role-Based Access Control
if (!Auth::roleBasedAccess($currentRole, "editor", "error/403")) {
    exit;
}
```

### 🎧 Event Dispatcher (Listeners + Observers)

[](#-event-dispatcher-listeners--observers)

```
use Rudra\EventDispatcher\EventDispatcherFacade as Dispatcher;

// Listeners — pub/sub with payload
Dispatcher::addListener('user.registered', [UserListener::class, 'onRegister']);
Dispatcher::dispatch('user.registered', ['id' => 1, 'email' => '...']);

// Observers — stateless notifications (no payload)
Dispatcher::attachObserver('before', [AuditObserver::class, 'onEvent']);
Dispatcher::notify('before');
```

### ✅ Fluent Validation

[](#-fluent-validation)

```
use Rudra\Container\Facades\Request;
use Rudra\Container\Facades\Session;
use Rudra\Validation\ValidationFacade as V;

$fields    = Request::post()->all();
$processed = [
    'name'        => V::sanitize($fields ['name'])->required()->min(3)->max(50)->run(),
    'email'       => V::email($fields ['email'])->run(),
    'age'         => V::sanitize($fields ['age'])->integer()->between(18, 100)->run(),
    'description' => V::set($fields['description'])->run(), // without validation
    'csrf'        => V::sanitize($fields['csrf'])->csrf(Session::get('csrf_token'))->run(),
];

if (V::approve($processed)) {
    $data = V::getValidated($processed, ["csrf", "_method"]);
} else {
    $errors = V::getErrors($processed);
}
```

### 🧭 RESTful Resources

[](#-restful-resources)

Registers standard CRUD routes with explicit plural and singular URL patterns. No magic pluralization — you define exactly what the URLs look like.

```
$router->resource('api/users', 'api/user', UserController::class);
```

This creates the following routes:

MethodURLController MethodDescriptionGETapi/usersindexList all usersGETapi/user/:idreadGet single userPOSTapi/userscreateCreate new userPUTapi/user/:idupdateFull update userPATCHapi/user/:idupdatePartial update userDELETEapi/user/:iddeleteDelete user> The default action names are \[index, read, create, update, delete\].

### Custom Method Names

[](#custom-method-names)

You can override the default action names by passing a custom array of 5 methods:

```
$router->resource('api/posts', 'api/post', PostController::class, [
    'actionIndex',   // GET    api/posts       — list all posts
    'actionView',    // GET    api/post/:id    — get single post
    'actionAdd',     // POST   api/posts       — create new post
    'actionUpdate',  // PUT/PATCH api/post/:id — update post
    'actionDrop'     // DELETE api/post/:id    — delete post
]);
```

> The array order is fixed: \[index, read, create, update, delete\].

### 🖼️ View with Caching

[](#️-view-with-caching)

```
use Rudra\View\ViewFacade as View;

// Cache-first strategy with fallback
echo View::cache(['mainpage', "+1 day"]) ?? View::render(["layout", "mainpage"], [
    'content' => View::cache(["page_{$slug}", "+1 day"])
        ?? View::view(["page", "page_{$slug}"], ['foo' => 'bar']),
]);

// Or with helpers
data(['content' => cache(['mainpage']) ?? view(['index', 'mainpage'])]);
render('layout', data());
```

💾 Data Access Layer (Rudra-Model)
---------------------------------

[](#-data-access-layer-rudra-model)

Rudra includes a lightweight, transparent data access layer — **not a heavy ORM**, but a simple Query Builder with Repository pattern.

### Architecture: Entity → Model → Repository

[](#architecture-entity--model--repository)

A predictable delegation chain with automatic fallback:

- **Entity** — entry point, defines the table name
- **Model** — business logic layer (optional)
- **Repository** — data access layer (optional, falls back to base CRUD)

If you don't create a Model or Repository, the base Repository handles standard CRUD automatically.

### Zero Boilerplate

[](#zero-boilerplate)

```
namespace App\Containers\User\Entity;

use Rudra\Model\Entity;

class User extends Entity
{
    public static ?string $table = 'users';
}

// Usage — no Model or Repository needed:
$users = User::getAll();
$user  = User::find(1);
User::create(['name' => 'John', 'email' => 'john@example.com']);
```

### Custom Repository Logic

[](#custom-repository-logic)

```
namespace App\Containers\User\Repository;

use Rudra\Model\Repository;

class UserRepository extends Repository
{
    public function findActiveUsers(): array
    {
        return $this->qBuilder("SELECT * FROM {$this->table} WHERE active = 1");
    }
}

// Automatically routed:
$activeUsers = User::findActiveUsers();
```

### Fluent Query Builder

[](#fluent-query-builder)

```
use Rudra\Model\QBFacade as QB;

$query = QB::select('id, name, email')
    ->from('users')
    ->where('status = :status')
    ->and('role = :role')
    ->orderBy('created_at DESC')
    ->limit(10)
    ->get();

// Execute via Repository:
$results = User::qBuilder($query, ['status' => 'active', 'role' => 'admin']);
```

### Schema Builder

[](#schema-builder)

```
use Rudra\Model\Schema;

Schema::create('users', function ($table) {
    $table->integer('id', '', true) // auto-increment
          ->string('name')
          ->string('email')
          ->text('bio', 'NULL')
          ->created_at()
          ->updated_at()
          ->pk('id');
})->execute();
```

### File-Based Caching

[](#file-based-caching)

Simple, reliable JSON file caching — no Redis/Memcached required:

```
// Cache query results
$users = User::cache(['getAll']);

// Cache with TTL
$posts = Post::cache(['findBy', ['category', 'news']], '+1 hour');

// Auto-clears on create/update/delete
```

### Why Not a Heavy ORM?

[](#why-not-a-heavy-orm)

- **No magic** — no hidden queries, no lazy loading surprises
- **No hidden dependencies** — direct PDO access when needed
- **Predictable** — you see exactly what SQL is executed
- **Fast** — no reflection overhead, no entity hydration complexity
- **Simple** — if you know SQL, you know Rudra-Model

🛠️ CLI Tools
------------

[](#️-cli-tools)

Rudra ships with a rich set of CLI utilities following the Porto architecture. Run `php rudra help` to see the full list.

### 🚀 Launch &amp; Help

[](#-launch--help)

CommandDescription`php rudra serve`Start the built-in dev server (alias: `run`)`php rudra help`List all available commands### 🛠️ Generators (`make:*`)

[](#️-generators-make)

CommandDescription`php rudra make:container`📦 Scaffold a new Porto container`php rudra make:controller`🧭 Generate a controller class`php rudra make:contract`📜 Generate an interface (contract)`php rudra make:factory`🏭 Generate a factory class`php rudra make:listener`👂 Generate an event listener`php rudra make:middleware`🛡️ Generate a middleware class`php rudra make:migration`🗄️ Generate a database migration`php rudra make:model`🧱 Generate Entity + Repository pair`php rudra make:observer`👁️ Generate an event observer`php rudra make:seed`🌱 Generate a database seeder`php rudra make:docs`📝 Generate documentation from source### 🗄️ Database

[](#️-database)

CommandDescription`php rudra migrate`🛤️ Run pending migrations (with duplicate protection)`php rudra seed`🌾 Execute seeders (with duplicate protection)### 🔍 Debug

[](#-debug)

CommandDescription`php rudra debug:router`🗺️ List all registered routes`php rudra debug:router:container`🔍 List routes for a specific container`php rudra debug:listeners`🎧 List registered event listeners`php rudra debug:observers`🔭 List registered event observers### 🔐 Security

[](#-security)

CommandDescription`php rudra bcrypt`🔐 Hash a password with bcrypt`php rudra secret`🔑 Generate a cryptographic secret (APP\_KEY)### 🧹 Maintenance &amp; Utils

[](#-maintenance--utils)

CommandDescription`php rudra cache:clear`🧹 Clear application cache`php rudra convert:array-to-yml`🔄 Convert a PHP array config to YAML (alias: `to:yml`)Features
--------

[](#features)

- **PHP 8.3 Attributes** for routing and middleware — clean, declarative syntax
- **Automatic Dependency Injection** with autowiring
- **5 container binding patterns**: string, object, factory string, factory object, closure
- **Event Dispatcher** with both Listeners and Observers
- **File-based caching** — simple, reliable, no external dependencies
- **Porto Architecture** — clear separation between Ship (shared) and Containers (modules)
- **DebugBar integration** with custom collectors (Security, PDO, Config)
- **Whoops** for beautiful error pages in development
- **Twig support** — optional, via factory binding
- **RESTful resources** — one line registers all CRUD routes
- **Method spoofing** — PUT/PATCH/DELETE from POST forms via `_method`
- **CSRF protection** built into validation and controllers

License
-------

[](#license)

This project is licensed under the **Mozilla Public License 2.0 (MPL-2.0)** — a free, open-source license that:

- ✅ Requires preservation of copyright and license notices
- ✅ Allows commercial and non-commercial use
- ✅ Requires that modifications to original files remain open under MPL-2.0
- ✅ Permits combining with proprietary code in larger works

📄 Full license text: [LICENSE](./LICENSE)
🌐 Official MPL-2.0 page:

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance99

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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 ~90 days

Total

5

Last Release

5d ago

Major Versions

v25.12 → v26.12025-12-29

PHP version history (2 changes)v25.6PHP &gt;=8.3

v26.7PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/75e65761bdd94035d1c783773a706d5722ce3164fe55d9722581c2cb4a642d8c?d=identicon)[jagepard](/maintainers/jagepard)

---

Top Contributors

[![Jagepard](https://avatars.githubusercontent.com/u/4591345?v=4)](https://github.com/Jagepard "Jagepard (316 commits)")

---

Tags

frameworkmvcmvc-architecturemvc-frameworkmvc-patternrudraframeworkmvcrudraMVC Frameworkmvc-patternmvc-architecture

### Embed Badge

![Health badge](/badges/rudra-framework/health.svg)

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[getkirby/cms

The Kirby core

1.5k567.4k438](/packages/getkirby-cms)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6941.5M398](/packages/drupal-core-recommended)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9417.2k58](/packages/open-dxp-opendxp)[doppar/framework

The Doppar Framework

4011.2k14](/packages/doppar-framework)

PHPackages © 2026

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