protected function setupPaths() { $basePath = str_finish(get_template_directory(), '/'); $controllersDirectory = $basePath . 'controllers'; $modelsDirectory = $basePath . 'models'; Illuminate\Support\ClassLoader::register(); Illuminate\Support\ClassLoader::addDirectories(array($controllersDirectory, $modelsDirectory)); }
<?php require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/illuminate/support/Illuminate/Support/helpers.php'; include __DIR__ . '/../app/Config/database.php'; $basePath = str_finish(dirname(__FILE__), '/'); $controllersDirectory = $basePath . '../app/src/Controllers'; $modelsDirectory = $basePath . '../app/src/Models'; $viewsDirectory = $basePath . '../app/Views'; $cacheDirectory = $basePath . '../app/Cache'; // register the autoloader and add directories Illuminate\Support\ClassLoader::register(); Illuminate\Support\ClassLoader::addDirectories(array($controllersDirectory, $modelsDirectory)); // Instantiate the container $app = new Illuminate\Container\Container(); // Tell facade about the application instance Illuminate\Support\Facades\Facade::setFacadeApplication($app); // register application instance with container $app['app'] = $app; // set environment $app['env'] = 'production'; with(new Illuminate\Events\EventServiceProvider($app))->register(); with(new Illuminate\Routing\RoutingServiceProvider($app))->register(); include $basePath . '../Routes.php'; // Instantiate the request $request = Illuminate\Http\Request::createFromGlobals(); if ($app['env'] == 'dev') { // Dispatch the router $response = $app['router']->dispatch($request); // Send the response $response->send();
| all of the other packages that we require from composer via the | prepackaged auto-loader which comes with composer. | */ require __DIR__ . '/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- | Load classes in a global namespace |-------------------------------------------------------------------------- | | Load any classes that are not in the PSR-4 namespace that we might be | needing at some point, this is usually controllers and models. | */ Illuminate\Support\ClassLoader::register(); Illuminate\Support\ClassLoader::addDirectories([__DIR__ . '/../app/controllers/']); /* |-------------------------------------------------------------------------- | Register any specified environment variables |-------------------------------------------------------------------------- */ if (file_exists(__DIR__ . '/../.env')) { Dotenv::load(__DIR__ . '/../'); } /* |-------------------------------------------------------------------------- | Create a new Application |-------------------------------------------------------------------------- | | Create an instance of our application implementing HttpKernelInterface | which facilitates the usage of stack-php middleware components.