TODO for stable release 1.0:
- basic i18n and translate utils
- installer wizard 60% (need refactor)
- ORM / query layer
- basic Migrations
- component stable sytem (80%
- frontend
- index
- threads views
- threds management
- comments management
- sitemap generator
- basic importer from other forum software like mybb, phpbb etc
- stats
- cache system initially file based, later add support for redis etc
- plugins/addons system
A lightweight custom PHP MVC framework with template engine support.
- ✅ Custom Router with flexible URL patterns
- ✅ MVC Architecture (Model-View-Controller)
- ✅ Custom Template Engine with syntax like
{{ variable }} - ✅ PDO Database Support
- ✅ Error Handling and Custom Error Pages
- ✅ PSR-4 Autoloading
- ✅ Clean URL Routing
mutedboard/
├── app/
│ ├── Controllers/ # Application controllers
│ ├── Models/ # Database models
│ └── views/ # View templates
│ ├── layouts/ # Layout templates
│ └── home/ # Page views
├── core/ # Framework core classes
│ ├── App.php
│ ├── Controller.php
│ ├── Model.php
│ ├── Router.php
│ ├── View.php
│ ├── Template.php
│ └── Error.php
├── config/ # Configuration files
│ ├── app.php
│ ├── database.php
│ └── routes.php
├── public/ # Web root (point your server here)
│ ├── index.php # Front controller
│ ├── .htaccess # Apache rewrite rules
│ ├── css/
│ └── js/
└── logs/ # Error logs (created automatically)
- Clone or download this framework to your web server
- Point your web server's document root to the
public/directory - Ensure
mod_rewriteis enabled (for Apache) - Update database configuration in
config/database.php - Configure routes in
config/routes.php
Make sure .htaccess is in the public/ directory and mod_rewrite is enabled.
Add this to your server block:
location / {
try_files $uri $uri/ /index.php?url=$uri&$args;
}cd public
php -S localhost:8000Controllers should be placed in app/Controllers/ and extend Core\Controller:
<?php
namespace App\Controllers;
use Core\Controller;
use Core\View;
class Example extends Controller
{
public function indexAction()
{
$data = ['title' => 'Example Page'];
View::renderWithTemplate('example/index.php', 'default', $data);
}
}Models should be placed in app/Models/ and extend Core\Model:
<?php
namespace App\Models;
use Core\Model;
use PDO;
class Example extends Model
{
public static function getAll()
{
$db = static::getDB();
$stmt = $db->query('SELECT * FROM table_name');
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
}Views are PHP templates stored in app/views/. Use layouts for consistent page structure.
<h1><?= htmlspecialchars($title) ?></h1>
<p>Content goes here</p><!DOCTYPE html>
<html>
<head>
<title><?= $title ?? 'My App' ?></title>
</head>
<body>
<?= $content ?>
</body>
</html>The custom template engine supports clean syntax:
{# Variables (auto-escaped) #}
{{ name }}
{{ user.email }}
{# Raw output (unescaped) #}
{{{ html_content }}}
{# Filters #}
{{ name|upper }}
{{ text|lower }}
{# Conditionals #}
{% if user %}
Welcome, {{ user.name }}!
{% else %}
Please log in
{% endif %}
{# Loops #}
{% foreach $items as $item %}
<li>{{ item.name }}</li>
{% endforeach %}Define routes in config/routes.php:
$router->add('', ['controller' => 'Home', 'action' => 'index']);
$router->add('{controller}/{action}');
$router->add('{controller}/{action}/{id:\d+}');
$router->add('posts/{id:\d+}', ['controller' => 'Posts', 'action' => 'show']);Update config/database.php with your database credentials:
return [
'host' => 'localhost',
'dbname' => 'your_database',
'username' => 'your_username',
'password' => 'your_password',
'charset' => 'utf8mb4'
];Three ways to render views:
// 1. Simple render (no layout)
View::render('home/index.php', ['title' => 'Home']);
// 2. With layout template
View::renderWithTemplate('home/index.php', 'default', ['title' => 'Home']);
// 3. Using custom template engine
$template = new Template('home/index.php');
$template->set('title', 'Home')->render();- Set
show_errorstotrueinconfig/app.phpduring development - Set to
falsein production (errors will be logged tologs/directory) - Custom 404 and 500 error pages in
app/views/
This is a custom framework for educational and project use.
