PHP code example of belicfr / mvclite

1. Go to this page and download the library: Download belicfr/mvclite library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

belicfr / mvclite example snippets


const ROUTE_PATH_PREFIX = '/';

const DATABASE_CREDENTIALS = [

    "dbms"      =>  "mysql",

    "host"      =>  "localhost",
    "port"      =>  "3306",
    "charset"   =>  "utf8mb4",
    "name"      =>  "",
    "user"      =>  "",
    "password"  =>  ""

];

Router::get('/path', Controller::class, "method");

Router::get('/path', Controller::class, "method")->setName('routeName');

Model::select('column1', 'column2')
       ->where('column', 'value')
       ->orderBy('column', 'ASC')
       ->execute();
	
Database::query('INSERT INTO table (column1, column2) VALUES (?, ?)', ['value1', 'value2']);

public function __construct()
{
    $this->middleware(AuthMiddleware::class);
}

View::render('View', ['data' => $data]);