v1.0.0 — First Release

Base
Framework

A lightweight PHP MVC framework built from scratch with OOP principles — routing, queues, scheduling, Redis, and a clean template engine, all under one roof.

Explore Architecture View File Tree GitHub
PHP 8.x · OOP · MVC · v1.0.0

// architecture

Core Modules

Every layer is isolated into a focused module. Here's what lives under the hood.

🔀

Routing

Compiles named routes with dynamic segments into optimised regex patterns. Dispatches HTTP requests to the right controller action.

Router.php Route.php RouteCompiler.php Request.php Response.php
🗄

Database & Query Builder

Fluent query builder with joins, aggregates, and where clauses. Wraps PDO with transaction management and SQL validation.

QueryBuilder.php JoinBuilder.php WhereBuilder.php SqlValidator.php
⚙️

Queue System

Async job processing via Database, Redis, or Sync drivers. Supports unique job guards to prevent duplicate execution.

QueueManager.php Worker.php DatabaseDriver.php RedisDriver.php
🕑

Task Scheduler

Cron-style task scheduling with a fluent PHP API. Register recurring tasks and let the Scheduler evaluate what's due on every tick.

Scheduler.php ScheduledTask.php Schedule.php
🖼

View Engine

Section-based PHP template engine with layout inheritance. Compose pages from named sections injected into shared layouts.

View.php layouts/main.php Components/
🔐

Security

Built-in CSRF token generation and validation on every state-changing request. Encryption helpers protect sensitive data end-to-end.

CSRF.php Encrypter.php Session.php

Redis Integration

Clean Redis connection layer with a configurable driver. Powers the Queue system and any custom caching needs.

RedisConnection.php RedisConnectionConfig.php Not implemented yet

Config & Environment

.env-based environment loading with per-domain config files (app, database, queue). Backup env support included.

Environment.php Config.php .env app.php
📁

File & Asset Helpers

FileReader/FileWriter abstractions for I/O. AssetManager serves versioned static URLs. Logger writes structured entries to Storage/Logs.

FileReader.php FileWriter.php AssetManager.php Logger.php

// highlights

Built-in Features

Everything you need to build a modern PHP application, nothing you don't.

🔀

Named Routes

Compile dynamic URL patterns at boot and generate URLs from route names anywhere in the app.

🧱

MVC Pattern

Controllers, Models, and Views with clean separation enforced by the directory structure.

💾

Query Builder

Chain where, join, and aggregate clauses — validated SQL, never raw string concatenation.

📋

Job Queues

Push work off the request cycle to Database, Redis, or in-process Sync drivers.

Task Scheduling

Define recurring cron jobs in PHP with a readable fluent API, no crontab editing needed.

🔐

CSRF Protection

Auto-generated tokens validated on every POST/PUT/DELETE request out of the box.

🔑

Encryption

Symmetric encryption for sensitive data with the Encrypter utility.

Redis Driver

First-class Redis connection for queue back-end or custom caching use cases.

🖼

Template Sections

Layout inheritance via named sections — styles, content, footer, scripts — in plain PHP.

📂

Asset Pipeline

Versioned static asset URLs via AssetManager; Tailwind CSS compiled output included.

📝

Structured Logging

Timestamped log entries written to Storage/Logs for debugging and monitoring.

🛡

Route Middleware

Attach middleware groups per route or per route group from a central registration file.


// file structure

Project Layout

A predictable directory convention so you always know where everything lives.

NM Base Framework /
App/
│ └──Controllers/HomeController.php → Application controllers
Config/
│ ├──.env → Environment variables
│ ├──app.php · database.php · job.php → Domain config files
│ └──secret.php → Keys & secrets
Core/
│ ├──Autoloader.php → PSR-style class autoloading
│ ├──Database/ → QueryBuilder + Builders + Validators
│ ├──Queue/ → Jobs, Worker, Drivers (DB · Redis · Sync)
│ ├──Routing/ → Router, Route, Request, Response
│ ├──Scheduler/ → Cron-style task scheduling
│ ├──Security/ → CSRF, Encrypter
│ ├──System/ → Config, Environment, Session
│ ├──Redis/ → Redis connection driver
│ └──ViewEngine/ → Section-based template engine
Public/
│ ├──index.php → Application entry point
│ └──Assets/ → images · scripts · styles
Resources/
│ ├──Layouts/ → Shared page layouts (main, error)
│ ├──Views/ → Page-level templates
│ ├──Components/ → Reusable UI partials
│ └──Parts/ → Structural partials (footer…)
Routes/
│ ├──public.php · dashboard.php → Route definitions by context
│ ├──middlewares.php → Global middleware registration
│ └──assets.php · installation.php → Special-purpose route groups
Storage/
├──Logs/app.log → Runtime application logs
├──Backup/ → Env & config backups
└──Files/ → User-generated or static assets

Ready to get started?

Clone the repo or browse the source code on GitHub.

View on GitHub Documentation