<?php

session_start();
include_once 'Framework' . DIRECTORY_SEPARATOR . 'Autoloader.php';
include_once 'Framework' . DIRECTORY_SEPARATOR . 'Application.php';
include_once 'Framework' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'Annotations.php';
\SoftUni\Autoloader::init();
\SoftUni\Core\Annotations::getAnnotations();
//\SoftUni\Core\Database::setInstance(
//    \SoftUni\Config\DatabaseConfig::DB_INSTANCE,
//    \SoftUni\Config\DatabaseConfig::DB_DRIVER,
//    \SoftUni\Config\DatabaseConfig::DB_USER,
//    \SoftUni\Config\DatabaseConfig::DB_PASS,
//    \SoftUni\Config\DatabaseConfig::DB_NAME,
//    \SoftUni\Config\DatabaseConfig::DB_HOST
//);
$app = new \SoftUni\Application();
$app->start();
?>


<?php

use Softuni\Core\Database;
use Softuni\Config\DatabaseConfig;
use Softuni\App;
use Softuni\Autoloader;
session_start();
require_once 'Autoloader.php';
Autoloader::init();
if (isset($_GET['uri'])) {
    $uri = explode('/', rtrim($_GET['uri'], '/'));
    if (count($uri)) {
        $controllerName = array_shift($uri);
    }
    if (count($uri)) {
        $actionName = array_shift($uri);
    }
    $params = $uri;
}
Database::setInstance(DatabaseConfig::DB_INSTANCE_NAME, DatabaseConfig::DB_DRIVER, DatabaseConfig::DB_USERNAME, DatabaseConfig::DB_PASSWORD, DatabaseConfig::DB_NAME, DatabaseConfig::DB_HOST);
$app = new App($controllerName, $actionName, $params);
$app->start();
Example #3
0
<?php

require_once 'Autoloader.php';
\SoftUni\Autoloader::register();
\SoftUni\Helpers\Session::start();
$phpSelf = $_SERVER['PHP_SELF'];
$index = basename($phpSelf);
\SoftUni\Helpers\RouteService::init(str_replace($index, '', $phpSelf));
$requestParams = [];
$controller = "users";
$action = "login";
if (isset($_GET['uri'])) {
    $requestParams = explode('/', $_GET['uri']);
    $controller = ucfirst(array_shift($requestParams));
    $action = ucfirst(array_shift($requestParams));
}
\SoftUni\Core\Database::setInstance(\SoftUni\Config\DatabaseConfig::DB_INSTANCE, \SoftUni\Config\DatabaseConfig::DB_DRIVER, \SoftUni\Config\DatabaseConfig::DB_USER, \SoftUni\Config\DatabaseConfig::DB_PASSWORD, \SoftUni\Config\DatabaseConfig::DB_NAME, \SoftUni\Config\DatabaseConfig::DB_HOST);
$app = new \SoftUni\Application($controller, $action, $requestParams);
$app->start();
Example #4
0
<?php

session_start();
require_once 'Autoloader.php';
\Softuni\Autoloader::init();
$uri = $_SERVER['REQUEST_URI'];
$self = $_SERVER['PHP_SELF'];
$directories = str_replace(basename($self), '', $self);
$requestString = str_replace($directories, '', $uri);
$requestParams = explode("/", $requestString);
$controller = array_shift($requestParams);
$action = array_shift($requestParams);
if ($controller == "" || $action == "") {
    $controller = \SoftUni\Config\RouteConfig::DEFAULT_CONTROLLER;
    $action = \SoftUni\Config\RouteConfig::DEFAULT_ACTION;
}
\SoftUni\Core\Database::setInstance(\SoftUni\Config\DatabaseConfig::DB_INSTANCE, \SoftUni\Config\DatabaseConfig::DB_DRIVER, \SoftUni\Config\DatabaseConfig::DB_USER, \SoftUni\Config\DatabaseConfig::DB_PASS, \SoftUni\Config\DatabaseConfig::DB_NAME, \SoftUni\Config\DatabaseConfig::DB_HOST);
$app = new \Softuni\Application($controller, $action, $requestParams);
$app->start();