From fa7a0765c7b307dbcec996e9ff131738d73af326 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 3 Dec 2025 12:16:48 +0100 Subject: [PATCH 1/2] [12.x] Document reload command --- deployment.md | 10 ++++++++++ packages.md | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/deployment.md b/deployment.md index 292e0be0221..f0af7e54897 100644 --- a/deployment.md +++ b/deployment.md @@ -11,6 +11,7 @@ - [Caching Events](#caching-events) - [Caching Routes](#optimizing-route-loading) - [Caching Views](#optimizing-view-loading) +- [Reloading Services](#reloading-services) - [Debug Mode](#debug-mode) - [The Health Route](#the-health-route) - [Deploying With Laravel Cloud or Forge](#deploying-with-cloud-or-forge) @@ -168,6 +169,15 @@ php artisan view:cache This command precompiles all your Blade views so they are not compiled on demand, improving the performance of each request that returns a view. + +## Reloading Services + +After deploying a new version of your application, any running services (eg. Reverb, Octane etc.) should be reloaded/restarted to use the new code. Laravel provides a single `reload` Artisan command that will reload all registered services: + +```shell +php artisan reload +``` + ## Debug Mode diff --git a/packages.md b/packages.md index 3fb9dd306f1..925aa2b4690 100644 --- a/packages.md +++ b/packages.md @@ -390,6 +390,22 @@ public function boot(): void } ``` +### Reload Commands + +Laravel's [reload command](/docs/{{version}}/deployment#reloading-services) reloads any running services. Using the `reloads` method, you may register your package's own Artisan commands that should be invoked when the `reload` commands is executed: + +```php +/** + * Bootstrap any package services. + */ +public function boot(): void +{ + if ($this->app->runningInConsole()) { + $this->reloads('package:reload'); + } +} +``` + ## Public Assets From 3e444933921cfcc02a55911efa17c30e94fb5ab8 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 4 Dec 2025 12:41:53 -0800 Subject: [PATCH 2/2] formatting --- deployment.md | 7 ++++++- packages.md | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/deployment.md b/deployment.md index f0af7e54897..40c3d2b3d49 100644 --- a/deployment.md +++ b/deployment.md @@ -172,12 +172,17 @@ This command precompiles all your Blade views so they are not compiled on demand ## Reloading Services -After deploying a new version of your application, any running services (eg. Reverb, Octane etc.) should be reloaded/restarted to use the new code. Laravel provides a single `reload` Artisan command that will reload all registered services: +> [!NOTE] +> When deploying to [Laravel Cloud](https://cloud.laravel.com), it is not necessary to use the `reload` command, as gracefully reloading of all services is handled automatically. + +After deploying a new version of your application, any long-running services such as queue workers, Laravel Reverb, or Laravel Octane should be reloaded / restarted to use the new code. Laravel provides a single `reload` Artisan command that will terminate these services: ```shell php artisan reload ``` +If you are not using [Laravel Cloud](https://cloud.laravel.com), you should manually configure a process monitor that can detect when your reloadable processes exit and automatically restart them. + ## Debug Mode diff --git a/packages.md b/packages.md index 925aa2b4690..0dd89623c30 100644 --- a/packages.md +++ b/packages.md @@ -14,6 +14,7 @@ - ["About" Artisan Command](#about-artisan-command) - [Commands](#commands) - [Optimize Commands](#optimize-commands) + - [Reload Commands](#reload-commands) - [Public Assets](#public-assets) - [Publishing File Groups](#publishing-file-groups) @@ -390,9 +391,10 @@ public function boot(): void } ``` + ### Reload Commands -Laravel's [reload command](/docs/{{version}}/deployment#reloading-services) reloads any running services. Using the `reloads` method, you may register your package's own Artisan commands that should be invoked when the `reload` commands is executed: +Laravel's [reload command](/docs/{{version}}/deployment#reloading-services) terminates any running services so they can be automatically restarted by a system process monitor. Using the `reloads` method, you may register your package's own Artisan commands that should be invoked when the `reload` command is executed: ```php /**