vtr/mvc

A simple php framework mvc

v1.4.1 2016-01-08 03:21 UTC

This package is not auto-updated.

Last update: 2024-12-21 20:35:56 UTC


README

  • A simple PHP MVC Framework
  • PHP >= 5.5

Updates

VTRMVC 1.0 is CLOSE! Why ? I'm working with VTRMVC 2.0. We publish our new version soon.

How to use ?

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());
}

Do you need a sample ?

Please take a good look on "Sample" folder. You'll see how simple it is to do.