PHP Classes

File: core/bootstrap.php

Recommend this page to a friend!
  Classes of Nahidul Hasan   Simplex   core/bootstrap.php   Download  
File: core/bootstrap.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simplex
Example application based on a MVC framework
Author: By
Last change:
Date: 14 days ago
Size: 533 bytes
 

Contents

Class file image Download
<?php

use App\Core\App;


define('ROOT_DIR', realpath(__DIR__ . '/../'));

$dotenv = new Dotenv\Dotenv(ROOT_DIR);

$dotenv->load();


App::bind('config', require 'config.php');


App::bind('database', function(){
    new
QueryBuilder(
       
Connection::make(App::get('config')['database'])
    );
});


/**
 * Load view part
 *
 * @param $name
 * @param null $data
 * @return mixed
 */
function view($name, $data = null)
{
    if (!empty(
$data)) {
       
extract($data);
    }

    return require
"app/views/{$name}.view.php";
}