Documentation

1. Framework Overview

This is a lightweight MVC framework using PHP 8.x, PSR-4 autoloading, and Twig.

Root Path: All requests are directed to public/index.php via .htaccess.

2. Routing

Routes map a URL and HTTP Method to a Controller.

$router->add('POST', 'user/register', 'UserController@register');

3. Controllers

Controllers live in app/Controllers/. They process logic and return views.

  • Use Request::post() for data.
  • Use Validator::validate() for security.
  • Use $this->render() to display Twig files.

4. Models & Database

Models extend Core\Model and handle database interactions.

[Image of database schema relationship diagram]
// Example usage in Controller
(new User())->findByEmail($email);

The save() method uses an Upsert strategy (Update or Insert).

5. Views (Twig)

Templates use the .twig extension. The following globals are always available:

VariablePurpose
csrf_token()Generates hidden security token
flashDisplays one-time messages (Toasts)
sessionAccess to current session data