diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index ab4cb2ef2874..e9ae5f11cdcd 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -61,7 +61,9 @@ public function handle() clearstatcache(false, $environmentFile); } - if ($hasEnvironment && filemtime($environmentFile) > $environmentLastModified) { + if (! $this->option('no-reload') && + $hasEnvironment && + filemtime($environmentFile) > $environmentLastModified) { $environmentLastModified = filemtime($environmentFile); $this->comment('Environment modified. Restarting server...'); @@ -93,6 +95,10 @@ public function handle() protected function startProcess() { $process = new Process($this->serverCommand(), null, collect($_ENV)->mapWithKeys(function ($value, $key) { + if ($this->option('no-reload')) { + return [$key => $value]; + } + return $key === 'APP_ENV' ? [$key => $value] : [$key => false]; @@ -164,6 +170,7 @@ protected function getOptions() ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', '127.0.0.1'], ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', Env::get('SERVER_PORT')], ['tries', null, InputOption::VALUE_OPTIONAL, 'The max number of ports to attempt to serve from', 10], + ['no-reload', null, InputOption::VALUE_NONE, 'Do not reload the development server on .env file changes'], ]; } }