class Khan
Class Core Run Project
static protected
|
$instance |
public static
|
[object] |
create()
|
[create get instance in singleton] | |
protected
|
|
__construct()
|
No description | |
public
|
|
apps()
|
No description | |
public
|
[void |
services()
|
[services Load all services] | |
public
|
|
dispatch()
|
No description |
create()public static [object] create()
[create get instance in singleton]
[object] |
[Return khan instance] |
__construct()protected __construct()
apps()public apps()
services()public [void services()
[services Load all services]
[void |
[load and run services in framework] |
dispatch()public dispatch()
<?php
/**
* RouterKhan (Khan.php) - A fast, easy and flexible router system for PHP
*
* @author PaulaoDev <jskhanframework@gmail.com>
* @copyright (c) PaulaoDev
* @link https://github.com/PaulaoDev/router-khan
* @license MIT
*/
namespace App\Khan;
$dotenv = new \Dotenv\Dotenv(ROOT_FOLDER);
$dotenv->load();
define("ROOT_CORE", __DIR__);
/**
* Class Core Run Project
*/
class Khan {
protected static $instance = null;
/**
* [create get instance in singleton]
* @return [object] [Return khan instance]
*/
public static function create() {
if (self::$instance == null) {
self::$instance = new Khan();
}
return self::$instance;
}
protected function __construct() {}
/**
* Load Aliases in project
*/
private function aliases() {
$aliases = require ROOT_FOLDER . '/config/aliases.php';
foreach ($aliases as $key => $value) {
class_alias($value, $key);
}
}
public function apps(){
include_once __DIR__ . '/Component/Functions/Helpers.php';
include_once __DIR__ . '/Bootstrap/Config.php';
$callTo = $app::resolve('app');
$callTo = (array) $callTo();
foreach ($callTo as $key => $value) {
if (is_closure($value)) {
$value();
}
}
}
/**
* [services Load all services]
* @return [void [load and run services in framework]
*/
public function services() {
$this->aliases();
$this->apps();
}
public function dispatch() {
$this->services();
}
}