Partially revert and restore bootstrap/autoload.php

As discussed with @daftspunk, we now have to hard-code some overrides to ensure our helpers are loaded first. To keep the code DRY and self-explanatory, we do need to keep the autoload.php file.
This commit is contained in:
Ben Thomson 2020-01-20 15:11:38 +08:00
parent e099b7bdee
commit 60d6825c0d
4 changed files with 49 additions and 46 deletions

28
artisan
View File

@ -5,38 +5,28 @@ define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register Core Helpers
| Bootstrap dependencies
|--------------------------------------------------------------------------
|
| We cannot rely on Composer's load order when calculating the weight of
| each package. This line ensures that the core global helpers are
| always given priority one status.
| We use a custom bootstrap autoloader to load some October dependencies
| first, before bringing in all dependencies from Composer.
|
*/
$helperPath = __DIR__.'/vendor/october/rain/src/Support/helpers.php';
if (!file_exists($helperPath)) {
echo 'Missing vendor files, try running "composer install" or use the Wizard installer.'.PHP_EOL;
exit(1);
}
require $helperPath;
require __DIR__.'/bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
| Turn On The Lights
|--------------------------------------------------------------------------
|
| 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.
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*

35
bootstrap/autoload.php Normal file
View File

@ -0,0 +1,35 @@
<?php
/*
|--------------------------------------------------------------------------
| Register Core Helpers
|--------------------------------------------------------------------------
|
| We cannot rely on Composer's load order when calculating the weight of
| each package. This line ensures that the core global helpers are
| always given priority one status.
|
*/
$helperPath = __DIR__.'/../vendor/october/rain/src/Support/helpers.php';
if (!file_exists($helperPath)) {
echo 'Missing vendor files, try running "composer install" or use the Wizard installer.'.PHP_EOL;
exit(1);
}
require $helperPath;
/*
|--------------------------------------------------------------------------
| 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';

View File

@ -10,37 +10,15 @@ define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register Core Helpers
| Bootstrap dependencies
|--------------------------------------------------------------------------
|
| We cannot rely on Composer's load order when calculating the weight of
| each package. This line ensures that the core global helpers are
| always given priority one status.
| We use a custom bootstrap autoloader to load some October dependencies
| first, before bringing in all dependencies from Composer.
|
*/
$helperPath = __DIR__.'/vendor/october/rain/src/Support/helpers.php';
if (!file_exists($helperPath)) {
echo 'Missing vendor files, try running "composer install" or use the Wizard installer.'.PHP_EOL;
exit(1);
}
require $helperPath;
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
require __DIR__.'/bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="../../vendor/autoload.php"
bootstrap="../../bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"