https://github.com/pfcode/megumin-framework
Yet another simple MVC PHP framework
https://github.com/pfcode/megumin-framework
Last synced: 4 months ago
JSON representation
Yet another simple MVC PHP framework
- Host: GitHub
- URL: https://github.com/pfcode/megumin-framework
- Owner: pfcode
- License: mit
- Created: 2016-07-31T21:46:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T20:18:53.000Z (almost 3 years ago)
- Last Synced: 2025-07-22T16:47:56.981Z (5 months ago)
- Language: PHP
- Size: 31.3 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MeguminFramework
A simple MVC framework written in PHP. Name was inspired by Megumin from _Kono Subarashii Sekai ni Shukufuku wo!_ anime :)

### Overview
A main purpose of this project is to easily start a new project codebase using set of base classes and tools that are intended to make your work faster and keep the code clean.
Despite of mainstream PHP frameworks, this one provides only the most common components, such as:
* **Dispatcher** - performs routing to the controllers (with friendly URLs support)
* **ModelFactory** - manipulates Model storage by queries (SQL databases)
* **Model** - represents some data in project, such as UserModel, PostModel or so..
* **Controller** - handles data from inputs, manipulates on Models and presents results to user
* **View** - presents data from isolated variable scope on page
There are also basic implementations of some classes:
* **MySQLModelFactory** - ModelFactory that handles custom MySQL queries to retreive and manipulate data
* **ScopeDebugView** - View that displays informations about controller - can be used for debugging
### Installation
You only need to add new dependency to your `composer.json` file:
```
"require": {
"pfcode/megumin-framework": ">=1.0.0"
},
```
...and update your project (Composer should automatically download latest package):
```
composer update
```
### Quick Start
There's a sample `index.php` in `examples` directory that uses MeguminFramework and performs sample routing. Here is the basic part of it (assuming that sample controllers have been defined and autoloaded)
```
TestController::class,
"/test" => TestController::class,
"/" => DashboardController::class
));
// Perform routing and execute proper controller
Dispatcher::explosion();
```