aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorCamil Staps2016-09-25 23:56:46 +0200
committerCamil Staps2016-09-26 01:02:05 +0200
commit33ad0c14d168d36a4e7ad42dc6aa6a37a7335849 (patch)
tree0543b7d92f7f0b7706f4313ba10b18483f747798 /bootstrap
parentAdded unique visitors to statistics (diff)
Change from lumen 5.2 to laravel 5.3 (Resolves #1)
Diffstat (limited to 'bootstrap')
-rw-r--r--bootstrap/app.php96
-rw-r--r--bootstrap/autoload.php34
-rw-r--r--bootstrap/cache/.gitignore2
3 files changed, 57 insertions, 75 deletions
diff --git a/bootstrap/app.php b/bootstrap/app.php
index c72ab23..f2801ad 100644
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -1,109 +1,55 @@
<?php
-require_once __DIR__.'/../vendor/autoload.php';
-
-try {
- (new Dotenv\Dotenv(__DIR__.'/../'))->load();
-} catch (Dotenv\Exception\InvalidPathException $e) {
-}
-
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
-| Here we will load the environment and create the application instance
-| that serves as the central piece of this framework. We'll use this
-| application as an "IoC" container and router for this framework.
+| The first thing we will do is create a new Laravel application instance
+| which serves as the "glue" for all the components of Laravel, and is
+| the IoC container for the system binding all of the various parts.
|
*/
-$app = new Laravel\Lumen\Application(
- realpath(__DIR__.'/../')
+$app = new Illuminate\Foundation\Application(
+ realpath(__DIR__.'/../')
);
-$app->withFacades();
-
-$app->withEloquent();
-
/*
|--------------------------------------------------------------------------
-| Register Container Bindings
+| Bind Important Interfaces
|--------------------------------------------------------------------------
|
-| Now we will register a few bindings in the service container. We will
-| register the exception handler and the console kernel. You may add
-| your own bindings here if you like or you can make another file.
+| Next, we need to bind some important interfaces into the container so
+| we will be able to resolve them when needed. The kernels serve the
+| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
- Illuminate\Contracts\Debug\ExceptionHandler::class,
- App\Exceptions\Handler::class
+ Illuminate\Contracts\Http\Kernel::class,
+ App\Http\Kernel::class
);
$app->singleton(
- Illuminate\Contracts\Console\Kernel::class,
- App\Console\Kernel::class
+ Illuminate\Contracts\Console\Kernel::class,
+ App\Console\Kernel::class
);
-/*
-|--------------------------------------------------------------------------
-| Register Middleware
-|--------------------------------------------------------------------------
-|
-| Next, we will register the middleware with the application. These can
-| be global middleware that run before and after each request into a
-| route or middleware that'll be assigned to some specific routes.
-|
-*/
-
-// $app->middleware([
-// // Illuminate\Cookie\Middleware\EncryptCookies::class,
-// // Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
-// // Illuminate\Session\Middleware\StartSession::class,
-// // Illuminate\View\Middleware\ShareErrorsFromSession::class,
-// // Laravel\Lumen\Http\Middleware\VerifyCsrfToken::class,
-// ]);
-
-$app->routeMiddleware([
- 'auth' => App\Http\Middleware\Authenticate::class,
- 'login' => App\Http\Middleware\Login::class,
-]);
-
-/*
-|--------------------------------------------------------------------------
-| Register Service Providers
-|--------------------------------------------------------------------------
-|
-| Here we will register all of the application's service providers which
-| are used to bind services into the container. Service providers are
-| totally optional, so you are not required to uncomment this line.
-|
-*/
-
-$app->register(App\Providers\AppServiceProvider::class);
-$app->register(App\Providers\AuthServiceProvider::class);
-// $app->register(App\Providers\EventServiceProvider::class);
-
-$app->register(Illuminate\Mail\MailServiceProvider::class);
-$app->register(Arubacao\BasicAuth\BasicGuardServiceProvider::class);
+$app->singleton(
+ Illuminate\Contracts\Debug\ExceptionHandler::class,
+ App\Exceptions\Handler::class
+);
/*
|--------------------------------------------------------------------------
-| Load The Application Routes
+| Return The Application
|--------------------------------------------------------------------------
|
-| Next we will include the routes file so that they can all be added to
-| the application. This will provide all of the URLs the application
-| can respond to, as well as the controllers that may handle them.
+| This script returns the application instance. The instance is given to
+| the calling script so we can separate the building of the instances
+| from the actual running of the application and sending responses.
|
*/
-$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
- require __DIR__.'/../app/Http/routes.php';
-});
-
-$app->configure('mail');
-
return $app;
diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php
new file mode 100644
index 0000000..3830137
--- /dev/null
+++ b/bootstrap/autoload.php
@@ -0,0 +1,34 @@
+<?php
+
+define('LARAVEL_START', microtime(true));
+
+/*
+|--------------------------------------------------------------------------
+| Register The Composer Auto Loader
+|--------------------------------------------------------------------------
+|
+| Composer provides a convenient, automatically generated class loader
+| for our application. We just need to utilize it! We'll require it
+| into the script here so that we do not have to worry about the
+| loading of any our classes "manually". Feels great to relax.
+|
+*/
+
+require __DIR__.'/../vendor/autoload.php';
+
+/*
+|--------------------------------------------------------------------------
+| Include The Compiled Class File
+|--------------------------------------------------------------------------
+|
+| To dramatically increase your application's performance, you may use a
+| compiled class file which contains all of the classes commonly used
+| by a request. The Artisan "optimize" is used to create this file.
+|
+*/
+
+$compiledPath = __DIR__.'/cache/compiled.php';
+
+if (file_exists($compiledPath)) {
+ require $compiledPath;
+}
diff --git a/bootstrap/cache/.gitignore b/bootstrap/cache/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/bootstrap/cache/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore