A lightweight Mini PHP project following the MVC pattern with PSR-4 autoloading and a basic routing system - similar to micro-frameworks like Slim or Laravel, but without using any full-stack framework.
This is a minimal PHP MVC framework-style project that demonstrates:
- Custom ORM
- PSR-4 Autoloading
- SOLID Principles
- Custom Routing
- Basic Authentication (Register/Login)
- Layout & View rendering system
- ✅ Custom Router with Controller@method support
- ✅ PSR-4 Autoloading via Composer
- ✅ Basic ORM to interact with DB
- ✅ MVC pattern with views/layouts
- ✅ Form validation and error handling
- ✅ Registration and login system (using PHP Sessions or simple logic)
- PHP 8+
- Composer
- MySQL or SQLite
- Apache/Nginx (or use PHP's built-in server)
PHP-MVC-ORM/
├── app/
│ ├── controllers/
│ │ └── UserController.php
│ ├── models/
│ │ └── User.php
│ ├── services/
│ │ └── Auth.php
├── config/
│ └── database.php
├── core/
│ ├── Database.php
│ ├── Router.php
│ ├── Model.php
│ │── View.php
├── public/
│ └── index.php
├── routes/
│ └── web.php
├── composer.json
git clone https://github.com/learnphp/PHP-MVC-ORM.git
cd PHP-MVC-ORM
composer install
composer dump-autoload
If Composer is not installed or your PHP version has compatibility issues, you can install dependencies using the command below:
cd PHP-MVC-ORM
php composer.phar install # or update
💡 Make sure you have
composer.phar
in your project root if Composer is not globally installed. Attached composer compatibility for PHP 7.2+ users
Start PHP's built-in server:
php -S localhost:8000 -t public
Then open in browser:
http://localhost:8000/register
→ Shows registration formhttp://localhost:8000/login
→ Show the login page
-- Above two just for demostartion proposes.
$router->get('/register', 'UserController@registerForm');
$router->get('/login', 'UserController@loginForm');
$router->post('/register', 'UserController@register');
$router->post('/login', 'UserController@login');
POST /register
Content-Type: application/json
{
"name": "Chinmay",
"email": "chinmay235@example.com",
"password": "secret123"
}
POST /login
Content-Type: application/json
{
"email": "chinmay235@example.com",
"password": "secret123"
}
Feel free to reach out:
Chinmay Kumar Sahu
📧 chinmay235@gmail.com
💬 GitHub: @chinmay235
This project is licensed under the MIT License.