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

ActiveProject[Framework](/categories/framework)

strifejeyz/framework
====================

A Fast and Lightweight PHP MVC Framework.

1.5(1y ago)461[2 issues](https://github.com/strifejeyz/framework/issues)MITPHPPHP &gt;= 7.0

Since Oct 25Pushed 1mo ago5 watchersCompare

[ Source](https://github.com/strifejeyz/framework)[ Packagist](https://packagist.org/packages/strifejeyz/framework)[ RSS](/packages/strifejeyz-framework/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (7)Dependencies (1)Versions (7)Used By (0)

⚡ Strife PHP Framework
======================

[](#-strife-php-framework)

> A fast, lightweight PHP MVC framework designed for developers who prefer clean architecture, file-based routing, and a Vue.js-friendly front-end workflow.

---

Features
--------

[](#features)

- **Smart Routing** — File-based or explicit route definitions with full HTTP verb support.
- **Query Builder** — Active record database layer with full isolation between models, transactions, seeding, and JSON backups.
- **Compiled View Engine** — A blade-like template compiler that writes to disk cache (no `eval()`), with Vue-style component slots and layout composition.
- **Migration System** — Generate, run, and rollback schema changes via CLI.
- **Yamato CLI** — Code generation and database management from the command line.
- **Encryption &amp; Hashing** — Built-in tools for encoding strings.

---

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

[](#requirements)

- PHP 7.0 or higher
- A web server (Apache or Nginx)
- Composer

---

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

[](#installation)

```
git clone https://github.com/strifejeyz/framework.git
cd framework
composer install
```

Copy and configure your environment:

```
# Edit app/config/application.php — set APP_NAME, APP_KEY, BASE_URL, etc.
# Edit app/config/database.php   — set host, database, username, password
```

---

Directory Structure
-------------------

[](#directory-structure)

```
/
├── app/
│   ├── config/          # Application and database configuration
│   ├── controllers/     # Controller classes
│   ├── migrations/      # Database schema migration files
│   ├── models/          # Model classes extending QueryBuilder
│   ├── seeders/         # Database seeders
│   ├── views/           # Template files (.php)
│   └── routes.php       # Explicit route definitions
├── assets/
│   └── css/             # Public stylesheets
├── kernel/              # Framework core — do not modify
│   ├── database/        # QueryBuilder and connection drivers
│   ├── security/        # Encryption utilities
│   └── View.php         # Template engine (compiler + slots)
├── storage/
│   ├── cache/           # Compiled view cache
│   ├── backups/         # JSON database backups
│   └── logs/            # Application logs
├── index.php            # Application entry point
└── yamato               # CLI entry point

```

---

Configuration
-------------

[](#configuration)

Key constants in `app/config/application.php`:

ConstantDefaultPurpose`APP_NAME``'Strife App'`Application name used in views`DEV_MODE``TRUE`Enables dev-only tools — set `FALSE` in production`FILE_BASED_ROUTING``true`Toggle between file-based and explicit routing`CACHED_VIEWS``FALSE`Skip view recompilation on each request`MAINTENANCE_MODE``FALSE`Serves 503 to all requests when `TRUE`---

Routing
-------

[](#routing)

### File-Based Routing (Recommended)

[](#file-based-routing-recommended)

Enable in `app/config/application.php`:

```
const FILE_BASED_ROUTING = true;
```

With file-based routing, URLs are automatically mapped to controllers and methods:

URLResolves to`/home/index``HomeController::index()``/book/show``BookController::show()``/user/profile``UserController::profile()`No manual route registration required. Any HTTP method is accepted.

---

### Explicit Route Definitions

[](#explicit-route-definitions)

Set `FILE_BASED_ROUTING = false` and define routes in `app/routes.php`:

```
get('/users',          'UsersController@index');
post('/users/store',   'UsersController@store');
put('/users/update',   'UsersController@update');
patch('/users/modify', 'UsersController@modify');
delete('/users/remove','UsersController@destroy');
```

> **Tip:** To use `PUT`, `PATCH`, or `DELETE` from an HTML form, add a hidden `_method` input field:
>
> ```
>
>
>
> ```

Named routes:

```
get('users-list -> /users', 'UsersController@index');
```

---

### Route Priority

[](#route-priority)

**Specific (literal) routes always beat wildcard routes**, regardless of the order they are defined in `routes.php`. The router automatically sorts routes by specificity before matching — so this is always safe:

```
get('/:any', 'HomeController@index'); // registered first — does NOT hijack /about-us
get('/about-us', 'HomeController@about');
```

`/about-us` correctly resolves to `HomeController@about` every time.

---

### SPA Catch-All (Vue / React)

[](#spa-catch-all-vue--react)

When pairing Strife with a frontend SPA, define a `/:any` catch-all to serve your app shell for any unmatched single-segment URL. Vue Router or React Router then handles client-side navigation:

```
// API routes first
get('/api/books',      'Api\BookController@index');
post('/api/books',     'Api\BookController@store');

// SPA shell — catch everything else and let the frontend router decide
get('/:any', 'HomeController@index');
```

> **Note:** `/:any` only matches URLs with exactly **one path segment**. Multi-segment API routes like `/api/books` or `/api/books/42` are never affected.

---

Dev Tools
---------

[](#dev-tools)

### Route Inspector

[](#route-inspector)

When `DEV_MODE = TRUE`, a route inspector is available at `/_routes`. It lists every registered endpoint with its HTTP method, URL pattern, handler, and route name. Filter by method or search by URL in real time.

Set `DEV_MODE = FALSE` before deploying to production — the `/_routes` endpoint is not registered at all when disabled.

---

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

[](#controllers)

Create controllers in `app/controllers/`. Class names must be PascalCase and suffixed with `Controller`.

```
