Skip to content
/ MVC Public

This project is a template based on the MVC (Model-View-Controller) architectural model created to be used in the development of websites and web applications. This template can be used for creating applications / websites and Web APIs.

License

Notifications You must be signed in to change notification settings

EddyEduard/MVC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MVC Template

This project is a template based on the MVC (Model-View-Controller) architectural model created to be used in the development of websites and web applications. This template can be used for creating applications / websites and Web APIs.

Installation

Use the package manager git to install this template:

git clone https://github.com/EddyEduard/MVC.git

Usage

Let's talk about how to use the routes, models and libraries in any project:

Routes

The general form for initializing a route which calls an action from a controller is:

use App\Core\Route;

Route::Get("/Your/Path/{here}", [
    "controller" => "ControllerName",
    "action" => "ActionName"
]);

Or, the general form for initializing a route which call a callback function is:

use App\Core\Route;

Route::Get("/Your/Path/{here}", function($here){
    echo $here;
});

Models

To create a model the general form is shown below:

use App\Core\Model;

class TableModel extends Model
{
    public function __construct($database, $table)
    {
        parent::__construct($database, $table);
    }

    public $Id;

    ...
}

new UserModel(DATABASE, "TableName");

The variable named DATABASE is a global variable defined in the config.php and which contains all configuration for connecting to a certain database.

Libraries

To add new libraries in the project you need to put their paths in the following array (file Application.php column 15):

   private $libraries_files = [
       "Database" => [
           "MySQLConnection", "MySQLDatabase"
       ],
       "Storage" => [
           "Cookie", "Session"
       ]
   ];

If these paths are missing, the libraries will not be included in the application.

License

Distributed under the MIT License. See MIT for more information.

Contact

Eduard-Nicolae - eduard_nicolae@yahoo.com
Project link - https://github.com/EddyEduard/MVC

About

This project is a template based on the MVC (Model-View-Controller) architectural model created to be used in the development of websites and web applications. This template can be used for creating applications / websites and Web APIs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published