Introduction To NoClass™
NoClass™ is a procedural PHP MVC framework designed for simplicity and performance. Unlike traditional OOP frameworks, NoClass uses functions instead of classes, making it lightweight and easy to understand while maintaining a clean MVC structure.
Key Advantages
- No Classes, Pure Functions: Easy to learn and debug
- Built-in Caching: File-based and in-memory engine with automatic invalidation
- Security First: CSRF protection, XSS prevention, and secure session handling
- Flexible Routing: Pattern-based routes with parameter validation
- Procedural MVC: Clear separation of concerns without complex OOP hierarchies
- Zero Dependencies: Works out of the box with minimal setup
NoClass™ Philosophy and Conventions
NoClass is intentionally procedural: no controllers or models as classes, no service container, and no “magic” objects. The framework aims to be easy to read, easy to debug, and simple to deploy.
File naming philosophy (Capitalised vs lowercase)
NoClass uses file naming to communicate intent, not object-orientation. Capitalised filenames identify framework-invoked “entry point” files (controllers, middleware, core system files). Lowercase filenames are plain function collections (models and libraries).
| Layer | Folder | Recommended filename style | Examples | Why |
|---|---|---|---|---|
| Controllers | controllers/ |
Capitalised | Blog.php, User.php |
Public entry points (route targets) |
| Middleware | middleware/ |
Capitalised | Auth.php, Csrf.php |
Cross-cutting control logic |
| Core system | system/ |
Capitalised | Route.php, Respond.php |
Framework components invoked internally |
| Models | models/ |
lowercase | user.php, blog.php |
Business logic as function collections |
| Libraries | lib/ |
lowercase | email.php, security.php |
Reusable helpers and integrations |
| Views | views/ |
lowercase | blog/index.php |
Templates map naturally to URL paths |
Note: Linux file systems are case-sensitive. Keep your naming consistent to avoid “works on Windows but fails on Linux” issues.
Controller and action naming
- Controller file:
controllers/Blog.php - Action function:
indexAction(),showAction(), etc. - Default view mapping:
views/blog/index.php
Middleware naming
Middleware files are Capitalised (e.g. middleware/Auth.php) because they are called by name from routing/config.
Middleware functions inside can remain procedural and explicit.
Function prefixes for organisation
Because NoClass does not use objects, it helps to group functionality using function prefixes. This makes discovery and team collaboration easier.
- Models:
user_*,blog_*,order_*inmodels/ - Libraries:
email_*,security_*,http_*inlib/ - Middleware helpers:
auth_*style helpers inmiddleware/if needed
// models/user.php
function user_findById(int $id): ?array { /* ... */ }
function user_create(array $data): int { /* ... */ }
// lib/email.php
function email_send(string $to, string $subject, string $html): bool { /* ... */ }
function email_template(string $name, array $vars = []): string { /* ... */ }
Cross-reference
See Minimal App Walkthrough (End-To-End) for a full example following these conventions.
Changelog
v1.0.0 – Stable (2026-01-20)
- First official release of NoClass framework documentation.
- Procedural MVC architecture fully documented.
- Routing, controllers, models, and views standardised.
- Database helpers, query builder, and caching documented.
- Security, forms, validation, and performance guidance added.
- Terminology and tone normalised across all sections.
Pre‑v1.0 (Development)
- Internal framework iteration and stabilisation.
- Procedural design decisions finalised.
Quick Start (For The Impatient)
1. Installation
# Clone or extract NoClass to your web directory
cd /var/www/html
git clone https://github.com/your-repo/noclass.git
cd noclass
# If using file cache, ensure cache dir exists and is writable by the web user
mkdir -p cache
chmod 755 public/
chmod 755 cache/
2. Basic Configuration
<?php
// Debug and Environment
define('DEBUG', true); // Set to false in production
define('BASE_URL', 'http://localhost/noclass');
define('BASE_URI', '/noclass');
// Caching (choose one)
define('CACHING', CACHE_ENGINE); // Or CACHE_FILE for file-based
define('CACHE_TTL_DB', 300); // 5 minutes cache for queries
define('CACHE_TTL_ROUTE', 60); // 1 minute for routes
// Database
define('USE_DB', true); // Set false if not using database
3. Create Your First Controller
<?php
function index() {
data([
'message' => 'Hello NoClass!',
'time' => date('H:i:s')
]);
// Return null to allow default view rendering (views/hello/index.php)
return null;
}
function api_test() {
// Auto JSON response for AJAX / API style calls
return ['status' => 'success', 'message' => 'API working'];
}
4. Define a Route
<?php
return [
'hello' => [
'controller' => 'Hello',
'action' => ['index', 'api_test'],
'middleware' => [] // Optional middleware
]
];
5. Create a View
<?php require view_path('partials/header.php'); ?>
Default message
Current time: N/A