Skip to content

tijaniabdellatif/mvc-architecture

Repository files navigation

Overview

This project is a simple Model-View-Controller (MVC) framework built from scratch using native PHP. It follows best practices for structuring PHP applications and provides a foundation for developing web applications.

Features

  • Routing System: A simple router to handle requests and map them to controllers.

  • Model-View-Controller (MVC) Architecture: Separation of concerns for better maintainability.

  • Autoloading: Uses PSR-4 autoloading via Composer.

  • Template Engine: Uses native PHP for rendering views or twig

  • Database Connection: Simple database wrapper for handling queries based on PDO

  • Error Handling & Logging: Basic error handling and logging mechanism.

  • Session & Authentication: Implements session-based authentication.

Folder Structure

The Structure is in the beta version, a major changes will occur.

│── public/        # Public directory (index.php, assets, etc.)
│── src/
│   ├── app/       # Application core (MVC files)
│   │   ├── Controllers/
│   │   ├── Models/
│   │   ├── Views/
│   │   ├── Core/   # Framework core classes (Router, Controller, etc.)
│── vendor/        # Composer dependencies
│── composer.json  # Composer autoload configuration
│── .env           # Environment variables
│── .htaccess      # Apache configuration for URL rewriting

Installation

Prerequisites

  • PHP 8.x or higher

  • Composer installed

  • Apache/Nginx server with mod_rewrite enabled

Start the Development Server

php -S localhost:8000 -d display_errors=1 -t public

AI IDE :

  • Trae is an interactive IDE with an ai agent integrated to speed up productivity use it with caution : Trae.ai

License

This project is open-source and available under the MIT License.

About

MVC Architecture - PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published