- A simple PHP MVC Framework
- PHP >= 5.5
VTRMVC 1.0 is CLOSE! Why ? I'm working with VTRMVC 2.0. We publish our new version soon.
It's simple:
First, use composer...
...
"require" {
"vtr/mvc" : "dev-master"
}
$ composer install
Define a JSON configuration file for your application. (Take a look on file "start_sample.json"). But be attention to principal nodes:
{
...
"site_path" : ".",
"tmp_path" : "./tmp",
"log_path" : "./tmp/log",
"mvc" : {
"path" : "../app",
...
}
...
}
Define a tree folder, where you will put your MVC Code, must be:
App Folder/
|
├── Controller/ # Controllers folder
| ├── AppController.php
| └── HomeController.php
├── Model/ # Models folder
| ├── AppModel.php
| └── HomeModel.php
└── View/ # Views folder
└── Home/
└── index.php
After this, you can call the application:
<?php
include "../vendor/autoload.php"; // Composer file
try{
$url = isset($_GET["_url"]) ? $_GET["_url"] : ""; // URL passing by .htaccess
$app = new VTRMVC\Core\App();
$app->start("../public/app.json", $url);
}catch (Exception $ex) {
VTRMVC\Util\Util::varzx($ex->getMessage());
}
Please take a good look on "Sample" folder. You'll see how simple it is to do.