An open API service indexing awesome lists of open source software.

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

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 :)

![Name inspired by Megumin from Kono Subarashii Sekai ni Shukufuku wo!](http://i.imgur.com/BJ7WsCp.jpg)

### 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();
```