Skip to content

Commit c67cb44

Browse files
[12.x] Document reload command (#10935)
* [12.x] Document reload command * formatting --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent 729ed24 commit c67cb44

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

deployment.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Caching Events](#caching-events)
1212
- [Caching Routes](#optimizing-route-loading)
1313
- [Caching Views](#optimizing-view-loading)
14+
- [Reloading Services](#reloading-services)
1415
- [Debug Mode](#debug-mode)
1516
- [The Health Route](#the-health-route)
1617
- [Deploying With Laravel Cloud or Forge](#deploying-with-cloud-or-forge)
@@ -168,6 +169,20 @@ php artisan view:cache
168169

169170
This command precompiles all your Blade views so they are not compiled on demand, improving the performance of each request that returns a view.
170171

172+
<a name="reloading-services"></a>
173+
## Reloading Services
174+
175+
> [!NOTE]
176+
> 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.
177+
178+
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:
179+
180+
```shell
181+
php artisan reload
182+
```
183+
184+
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.
185+
171186
<a name="debug-mode"></a>
172187
## Debug Mode
173188

packages.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- ["About" Artisan Command](#about-artisan-command)
1515
- [Commands](#commands)
1616
- [Optimize Commands](#optimize-commands)
17+
- [Reload Commands](#reload-commands)
1718
- [Public Assets](#public-assets)
1819
- [Publishing File Groups](#publishing-file-groups)
1920

@@ -390,6 +391,23 @@ public function boot(): void
390391
}
391392
```
392393

394+
<a name="reload-commands"></a>
395+
### Reload Commands
396+
397+
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:
398+
399+
```php
400+
/**
401+
* Bootstrap any package services.
402+
*/
403+
public function boot(): void
404+
{
405+
if ($this->app->runningInConsole()) {
406+
$this->reloads('package:reload');
407+
}
408+
}
409+
```
410+
393411
<a name="public-assets"></a>
394412
## Public Assets
395413

0 commit comments

Comments
 (0)