RegisterFacades.php
TLDR
This file defines a class called RegisterFacades
in the Illuminate\Foundation\Bootstrap
namespace. The RegisterFacades
class has a method called bootstrap
which is used to bootstrap an application by setting up facades.
Methods
bootstrap
This method is used to bootstrap an application. It takes an instance of the Application
interface as a parameter and does the following:
- Clears all previously resolved facades instances.
- Sets the facade application to the given
Application
instance. - Creates an
AliasLoader
instance by merging the application's configured aliases with the aliases defined in the package manifest. It then registers the alias loader.
Classes
No classes are defined in this file.
<?php
namespace Illuminate\Foundation\Bootstrap;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Foundation\PackageManifest;
use Illuminate\Support\Facades\Facade;
class RegisterFacades
{
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public function bootstrap(Application $app)
{
Facade::clearResolvedInstances();
Facade::setFacadeApplication($app);
AliasLoader::getInstance(array_merge(
$app->make('config')->get('app.aliases', []),
$app->make(PackageManifest::class)->aliases()
))->register();
}
}