Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 34 lines (26 sloc) 0.904 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
<?php
if(!defined('DS'))
    define('DS', DIRECTORY_SEPARATOR);

define('APP_SRC', dirname(__FILE__));

$root = dirname(dirname(__FILE__));
$lib = $root . DS . 'lib';

//require composer autoloader
require_once $lib . DS . 'autoload.php';

//get composer loader that already has vendors loaded
$loader = ComposerAutoloaderInit::getLoader();

//load application namespaces
$namespaces = array_fill_keys(['Domain', 'Infrastructure', 'Test', 'Presentation'], APP_SRC);
foreach($namespaces as $namespace => $path) {
    $loader->add($namespace, $path);
}

$classes = [
    'TwigView' => $lib . DS . '/slim/extras/Views/TwigView.php',
    'Slim_View' => $lib . DS . '/slim/slim/Slim/View.php',
    'Slim_Http_Request' => $lib . DS . '/slim/slim/Slim/Http/Request.php'
];

$map = [];
foreach($classes as $class => $path) {
    if(file_exists($path))
        $map[$class] = $path;
}

$loader->addClassMap($map);
Something went wrong with that request. Please try again.