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.
// 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:
| Variable | Purpose |
|---|---|
csrf_token() | Generates hidden security token |
flash | Displays one-time messages (Toasts) |
session | Access to current session data |