protected function ServerCommand::boot in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Command/ServerCommand.php \Drupal\Core\Command\ServerCommand::boot()
- 9 core/lib/Drupal/Core/Command/ServerCommand.php \Drupal\Core\Command\ServerCommand::boot()
Boots up a Drupal environment.
Return value
\Drupal\Core\DrupalKernelInterface The Drupal kernel.
Throws
\Exception Exception thrown if kernel does not boot.
File
- core/
lib/ Drupal/ Core/ Command/ ServerCommand.php, line 92
Class
- ServerCommand
- Runs the PHP webserver for a Drupal site for local testing/development.
Namespace
Drupal\Core\CommandCode
protected function boot() {
$kernel = new DrupalKernel('prod', $this->classLoader, FALSE);
$kernel::bootEnvironment();
$kernel
->setSitePath($this
->getSitePath());
Settings::initialize($kernel
->getAppRoot(), $kernel
->getSitePath(), $this->classLoader);
$kernel
->boot();
// Some services require a request to work. For example, CommentManager.
// This is needed as generating the URL fires up entity load hooks.
$kernel
->getContainer()
->get('request_stack')
->push(Request::createFromGlobals());
return $kernel;
}