Skip to content
/ mvc_template Public template

Template for PHP projects with MVC architecture, routing system, middleware support, and componentization. Includes utilities for data manipulation, file uploads, and much moreβ€”perfect for scalable and well-structured projects. πŸš€

License

Notifications You must be signed in to change notification settings

3nderXP/mvc_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MVC Template for PHP projects

This repository serves as a base model for PHP projects, implementing the MVC pattern, Routes system, Middlewares and Componentization in the Controller and View layers. It also includes several utility tools to speed up development.


Project Structure

mvc_template/
β”œβ”€β”€ app
β”‚   β”œβ”€β”€ Classes
β”‚   β”‚   └── Utils
β”‚   β”‚       β”œβ”€β”€ ApiResponse.php
β”‚   β”‚       β”œβ”€β”€ ArrayUtils.php
β”‚   β”‚       β”œβ”€β”€ CrudUtils.php
β”‚   β”‚       β”œβ”€β”€ FileUploader.php
β”‚   β”‚       β”œβ”€β”€ Formatting.php
β”‚   β”‚       β”œβ”€β”€ Math.php
β”‚   β”‚       β”œβ”€β”€ Url.php
β”‚   β”‚       β”œβ”€β”€ UUID.php
β”‚   β”‚       └── View.php
β”‚   β”œβ”€β”€ config.php
β”‚   └── Core
β”‚       β”œβ”€β”€ Controller
β”‚       β”‚   β”œβ”€β”€ Components
β”‚       β”‚   β”‚   β”œβ”€β”€ BaseStructure.php
β”‚       β”‚   β”‚   β”œβ”€β”€ Link.php
β”‚       β”‚   β”‚   β”œβ”€β”€ Links.php
β”‚       β”‚   β”‚   β”œβ”€β”€ Script.php
β”‚       β”‚   β”‚   └── Scripts.php
β”‚       β”‚   β”œβ”€β”€ Middlewares
β”‚       β”‚   └── Pages
β”‚       β”‚       └── Home.php
β”‚       β”œβ”€β”€ Model
β”‚       β”‚   β”œβ”€β”€ Databases
β”‚       β”‚   β”‚   └── SQL.php
β”‚       └── View
β”‚           β”œβ”€β”€ Components
β”‚           β”‚   β”œβ”€β”€ BaseStructure
β”‚           β”‚   β”œβ”€β”€ Link
β”‚           β”‚   β”œβ”€β”€ Option
β”‚           β”‚   └── Script
β”‚           └── Pages
β”‚               └── Home
β”‚                   └── index.html
β”œβ”€β”€ assets
β”‚   β”œβ”€β”€ css
β”‚   β”‚   β”œβ”€β”€ global.css
β”‚   β”‚   └── home.css
β”‚   └── img
β”‚       └── logo.jpg
β”œβ”€β”€ index.php
β”œβ”€β”€ composer.json
β”œβ”€β”€ .env.example
└── README.md

Features

Conceito Descrição
MVC Modular organization between logic (Model), control (Controller) and visualization (View).
Routes Configured in app/Core/Routers.php, they allow you to associate URLs with controller methods.
Middlewares Manage checks before executing routes.
Componentization Reuse of visual and logical elements, such as Links and Scripts.
Utilities Classes for manipulating arrays, uploading files, generating UUIDs, and more.

Installation

  • Clone this repository:
git clone https://github.com/3nderXP/mvc_template.git
  • Install the dependencies:
composer install
  • Configure the environment:

Change necessary variables, such as database credentials, roots and the like.

Usage

Routes: Configure routes in the file app/Core/Routers.php:

$router->get('/home', [HomeController::class, 'index']);

Controllers: Create Controllers in `app/Core/Controller/Pages/`` and implement methods associated with routes.

Views: Create HTML files in app/Core/View/Pages/ and render in the controllers:

return View::render('Pages/Home', ['data' => $value]);

Requirements:

  • PHP >= 8.0
  • Composer

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Contributions

Contributions are welcome! Open issues or send pull requests with improvements and suggestions.

About

Template for PHP projects with MVC architecture, routing system, middleware support, and componentization. Includes utilities for data manipulation, file uploads, and much moreβ€”perfect for scalable and well-structured projects. πŸš€

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published