PHPackages                             glivers/rackage - 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. glivers/rackage

ActivePackage[Framework](/categories/framework)

glivers/rackage
===============

This is a collection of all the PHP classes that make Rachie a real MVC framework

v2.0.7(2mo ago)16123MITPHPPHP &gt;=8.0.0

Since Jan 20Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/glivers/rackage)[ Packagist](https://packagist.org/packages/glivers/rackage)[ RSS](/packages/glivers-rackage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)DependenciesVersions (9)Used By (3)

Rackage
=======

[](#rackage)

**Core engine for the Rachie PHP Framework**

Rackage provides the MVC architecture, routing system, database abstraction, templating engine, and utilities that power the Rachie framework. While Rachie is the complete application framework, Rackage is the engine that makes it work.

[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Architecture](#architecture)
- [Routing](#routing)
- [Controllers](#controllers)
- [Models](#models)
- [Views](#views)
- [Core Classes](#core-classes)
- [Testing](#testing)
- [License](#license)

Requirements
------------

[](#requirements)

- PHP 7.1 or higher
- MySQLi extension (for database features)
- Apache with mod\_rewrite (or equivalent)

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

[](#installation)

Rackage is installed automatically as a dependency of Rachie:

```
composer require glivers/rachie
```

It should not be installed standalone - use the [Rachie framework](https://github.com/glivers/rachie) instead.

Architecture
------------

[](#architecture)

Rackage implements a classic MVC pattern with these core components:

### Component Flow

[](#component-flow)

```
Request → Router → Controller → Model/View → Response

```

1. **Router** - Parses URLs, matches routes, dispatches to controllers
2. **Controller** - Handles business logic, coordinates models and views
3. **Model** - Database operations with query builder
4. **View** - Template rendering with compilation
5. **Registry** - Centralized configuration storage
6. **Input** - Unified request data access

Routing
-------

[](#routing)

### URL-Based Routing (No Configuration Required)

[](#url-based-routing-no-configuration-required)

Rackage routes URLs directly to controllers without any route definitions:

```
URL Format: /Controller/method/param1/param2

Examples:
/Blog/show/123        → BlogController::show('123')
/User/edit/456        → UserController::edit('456')
/Admin/dashboard      → AdminController::dashboard()

```

### HTTP Method Prefixes

[](#http-method-prefixes)

Controllers can use HTTP verb prefixes for RESTful routing:

```
class UserController extends Controller {
    public function getProfile() {
        // Handles GET /User/profile
    }

    public function postProfile() {
        // Handles POST /User/profile
    }

    public function putProfile() {
        // Handles PUT /User/profile
    }

    public function deleteProfile() {
        // Handles DELETE /User/profile
    }
}
```

### Route Definitions

[](#route-definitions)

For custom URLs that differ from controller names:

```
// config/routes.php
return [
    'blog' => 'Posts',                    // /blog → PostsController
    'contact' => 'Pages@contact',         // /contact → PagesController::contact()
    'profile' => 'User@show/id',          // /profile/123 → $id = '123'
    'blog/*' => 'Blog@show/slug',         // /blog/my-post → $slug = 'my-post'
    'products/*' => 'Products@show/slug', // Wildcard routes
];
```

### Route Priority

[](#route-priority)

Routes are checked in this order:

1. Exact matches (`'about' => 'Pages@about'`)
2. Pattern matches (`'blog/*' => 'Blog@show/slug'`)
3. URL-based routing (`/Controller/method`)
4. Catch-all (if enabled)
5. 404 error

### Catch-All Routing (CMS Mode)

[](#catch-all-routing-cms-mode)

Enable in `config/settings.php` for dynamic content:

```
'routing' => [
    'catch_all' => true,
    'catch_all_controller' => 'Pages',
    'catch_all_method' => 'show',
]
```

Perfect for CMS, e-commerce, or any app with database-driven URLs.

Controllers
-----------

[](#controllers)

Controllers extend `Rackage\Controller` and handle application logic.

### Basic Controller

[](#basic-controller)

```
