Version: 1.0.0
Date: 2025-06-17
Author: Michael Emmanuel
A lightweight PHP MVC framework built for educational purposes to demonstrate core architectural patterns and modern PHP development practices.
| Category | Features |
|---|---|
| Core Framework | MVC architecture, Routing System, Active Record ORM |
| Security | Session-based Authentication, Input Validation, CSRF Protection |
| Developer Tools | CLI Tool (Sh), Migration System, Scaffolding Generators |
| Database | PDO Database Abstraction, Query Builder, Migration Management |
- PHP 7.4+ with PDO extension
- MySQL 5.7+ or MariaDB 10.2+
- Apache/Nginx with mod_rewrite enabled
- Composer (for dependency management)
# Clone repository
git clone https://github.com/Mke5/php-mvc.git
# Navigate to project
cd php-mvc
# Configure environment (copy example)
cp app/core/config.example.php app/core/config.php
# Edit configuration
nano app/core/config.php
- define('DBHOST', 'localhost');
- define('DBNAME', 'your_database');
- define('DBUSER', 'root');
- define('DBPASS', 'password');
- define('ROOTPATH', '/your/project/path/');
app/
├── Core/ # Framework core components
│ ├── App.php # Application bootstrap
│ ├── Model.php # Base Model
│ ├── Controller.php # Base Controller
│ └── Database.php # Database connection
├── Controllers/ # Application controllers
├── Models/ # Database models
├── Views/ # Template files
├── migrations/ # Database migration files
└── sh/ # CLI Tool (Sh)
public/ # Web root
├── index.php # Front controller
└── assets/ # Static resources
Location: app/sh/Sh.php Purpose: Command-line interface for application management
# Make executable
chmod +x sh.php
# Verify installation
php sh.php help
db:create Creates application database
db:drop Drops database (with confirmation)
db:migrate Executes pending migrationsmake:controller Creates new controller
make:model Creates new model with ORM methods
make:migration Creates database migration file# Create new table
php sh.php make:migration [table_name] [column:type] [options]
# Alter existing table
php sh.php make:migration alter:[table_name] [column:type] [options]| Type | Description | Example | Options |
|---|---|---|---|
| string | VARCHAR(255) | name:string | unique, index |
| text | TEXT | bio:text | - |
| integer | INT | user_id:integer | Foreign keys |
| boolean | TINYINT(1) | is_admin:boolean | - |
| datetime | DATETIME | created_at:datetime | - |
| float | FLOAT | price:float | - |
| double | DOUBLE | rating:double | - |
| enum | ENUM(values) | role:enum:admin;user | - |
php sh.php make:migration posts \
title:string \
content:text \
user_id:integer:usersphp sh.php make:migration products \
status:enum:in_stock;out_of_stock;discontinued# Start development server
php -S localhost:8000 -t public
# Run migrations
php sh.php db:create
php sh.php db:migrate
# Access in browser
http://localhost:8000