almhdy24 / php-mini-mvc
Professional PHP Mini MVC Skeleton
Requires (Dev)
- symfony/var-dumper: ^8.0
This package is auto-updated.
Last update: 2026-03-22 09:54:18 UTC
README
This is a simple, clean, and lightweight MVC (Model-View-Controller) starter kit built specifically for PHP 8+. It is perfect if you want to build a small-to-medium web project without the complexity or weight of a huge framework. It keeps things fast, organized, and easy to understand.
📑 Table of Contents
✨ Features
- 🏗️ Classic MVC Pattern: Clear separation of concerns between logic, data, and presentation.
- 📦 PSR-4 Autoloading: Modern class loading using Composer.
- 🛣️ Custom Router: Lightweight URL routing with support for dynamic parameters (e.g.,
/users/{id}). - 🗄️ Base Model (PDO): Ready-to-use SQLite integration with common CRUD operations.
- 🛡️ Error Handling: Custom exception and error handling for cleaner debugging.
- ⚡ Zero Bloat: Extremely minimal codebase; perfect for rapid prototyping.
🛠️ Tech Stack
- Language: PHP 8+
- Package Manager: Composer
- Database: SQLite (default)
- Architecture: MVC
📥 Installation
-
Clone the repository:
git clone https://github.com/almhdy24/php-mini-mvc.git cd php-mini-mvc -
Install dependencies:
composer install
-
Start the local server:
php -S localhost:8000 -t public
-
Access the application at
http://localhost:8000.
💡 Usage
Adding a New Route
Edit routes/web.php to map URLs to Controllers:
$router->get('/profile', ['ProfileController', 'index'], 'profile');
Creating a Controller
Create a new file in app/Controllers/ extending App\Core\Controller:
namespace App aulControllers; use App\Core\Controller; class ProfileController extends Controller { public function index() { $this->view('profile', ['user' => 'John Doe']); } }
📁 Project Structure
| Path | Description |
|---|---|
/app |
Core application logic (Controllers, Models, Views) |
/config |
Application configuration files |
/public |
Entry point of the application (index.php) |
/routes |
Route definitions |
/storage |
SQLite database file storage |
📜 License
Distributed under the MIT License. See LICENSE for more information.
🔗 Important Links
Built with ❤️ by almhdy24 | View on GitHub
If you find this project useful, please consider giving it a star! 🌟