Skip to content

πŸ› οΈ A beginner-friendly PHP MVC blog system built from scratch. Includes user authentication, post CRUD, and a custom lightweight MVC frameworkβ€”perfect for learning PHP OOP and web development fundamentals.

Notifications You must be signed in to change notification settings

rawbinn/basic-mvc-structure-using-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PHP MVC Blog System

A simple blog application built using a custom PHP MVC (Model-View-Controller) framework.
This project is beginner-friendly and ideal for learning PHP OOP, routing, authentication, and CRUD operations.

πŸš€ Features

  • βœ… Custom MVC framework (no external dependencies)
  • βœ… User registration and login
  • βœ… Post CRUD (Create, Read, Update, Delete)
  • βœ… Session-based authentication
  • βœ… MySQL database integration
  • βœ… Clean file structure for easy understanding

πŸ“ Project Structure

project/
β”œβ”€β”€ assets/ # For css/js/images
β”‚ └── css
β”‚   └── style.css
β”‚ └── js
β”‚ └── images
β”‚
β”œβ”€β”€ config/ # Database config
β”‚ └── database.php
β”‚
β”œβ”€β”€ controllers/ # Controller classes
β”‚ β”œβ”€β”€ AuthController.php
β”‚ └── PostController.php
β”‚
β”œβ”€β”€ core/ # Core framework (MVC base)
β”‚ β”œβ”€β”€ App.php
β”‚ β”œβ”€β”€ Controller.php
β”‚ └── Model.php
β”‚
β”œβ”€β”€ models/ # Model classes
β”‚ β”œβ”€β”€ User.php
β”‚ └── Post.php
β”‚
β”œβ”€β”€ views/ # View files (HTML/PHP)
β”‚ β”œβ”€β”€ auth/
β”‚ β”œβ”€β”€ post/
β”‚ └── layouts/
β”‚
└── index.php # Entry point

πŸ§‘β€πŸ’» Requirements

  • PHP 7.4 or higher
  • MySQL or MariaDB
  • Apache or Nginx

βš™οΈ Installation

  1. Clone the repo
git clone https://github.com/rawbinn/basic-mvc-structure-using-php.git
cd basic-mvc-structure-using-php
  1. Create the database and tables You can find sql in migrations directory

  2. Configure database connection

Edit config/database.php:

    <?php
    return [
        'host' => 'localhost',
        'username' => 'root',
        'password' => '', // set your DB password
        'database' => 'your_database_name'
    ];
  1. Run the app Place the project in your web server’s root directory (e.g., htdocs for XAMPP) Start Apache/MySQL

Visit: http://localhost/basic-mvc-structure-using-php/index.php

πŸ§ͺ Demo Routes Feature URL

Home	/index.php
Register	/index.php?url=auth/register
Login	/index.php?url=auth/login
Post List	/index.php?url=post/index
Create Post	/index.php?url=post/create
Edit Post /index.php?url=post/edit/1

About

πŸ› οΈ A beginner-friendly PHP MVC blog system built from scratch. Includes user authentication, post CRUD, and a custom lightweight MVC frameworkβ€”perfect for learning PHP OOP and web development fundamentals.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published