docs/recipe/laravel.md
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit recipe/laravel.php -->
<!-- Then run bin/docgen -->
# How to Deploy a Laravel Project
```php
require 'recipe/laravel.php';
```
[Source](/recipe/laravel.php)
Deployer is a free and open source deployment tool written in PHP.
It helps you to deploy your Laravel application to a server.
It is very easy to use and has a lot of features.
Three main features of Deployer are:
- **Provisioning** - provision your server for you.
- **Zero downtime deployment** - deploy your application without a downtime.
- **Rollbacks** - rollback your application to a previous version, if something goes wrong.
Additionally, Deployer has a lot of other features, like:
- **Easy to use** - Deployer is very easy to use. It has a simple and intuitive syntax.
- **Fast** - Deployer is very fast. It uses parallel connections to deploy your application.
- **Secure** - Deployer uses SSH to connect to your server.
- **Supports all major PHP frameworks** - Deployer supports all major PHP frameworks.
You can read more about Deployer in [Getting Started](/docs/getting-started.md).
The [deploy](#deploy) task of **Laravel** consists of:
* [deploy:prepare](/docs/recipe/common.md#deployprepare) – Prepares a new release
* [deploy:info](/docs/recipe/deploy/info.md#deployinfo) – Displays info about deployment
* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) – Prepares host for deploy
* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) – Locks deploy
* [deploy:release](/docs/recipe/deploy/release.md#deployrelease) – Prepares release
* [deploy:update_code](/docs/recipe/deploy/update_code.md#deployupdate_code) – Updates code
* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) – Creates symlinks for shared files and dirs
* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) – Makes writable dirs
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors) – Installs vendors
* [artisan:storage:link](/docs/recipe/laravel.md#artisanstoragelink) – Creates the symbolic links configured for the application
* [artisan:config:cache](/docs/recipe/laravel.md#artisanconfigcache) – Creates a cache file for faster configuration loading
* [artisan:route:cache](/docs/recipe/laravel.md#artisanroutecache) – Creates a route cache file for faster route registration
* [artisan:view:cache](/docs/recipe/laravel.md#artisanviewcache) – Compiles all of the application\'s Blade templates
* [artisan:event:cache](/docs/recipe/laravel.md#artisaneventcache) – Discovers and cache the application\'s events and listeners
* [artisan:migrate](/docs/recipe/laravel.md#artisanmigrate) – Runs the database migrations
* [deploy:publish](/docs/recipe/common.md#deploypublish) – Publishes the release
* [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) – Creates symlink to release
* [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) – Unlocks deploy
* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) – Cleanup old releases
* [deploy:success](/docs/recipe/common.md#deploysuccess) –
The laravel recipe is based on the [common](/docs/recipe/common.md) recipe.
## Configuration
### shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L9)
Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`.
```php title="Default value"
['storage']
```
### shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L10)
Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`.
```php title="Default value"
['.env']
```
### writable_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L11)
Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`.
```php title="Default value"
[
'bootstrap/cache',
'storage',
'storage/app',
'storage/app/public',
'storage/framework',
'storage/framework/cache',
'storage/framework/cache/data',
'storage/framework/sessions',
'storage/framework/views',
'storage/logs',
]
```
### log_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L23)
```php title="Default value"
'storage/logs/*.log'
```
### laravel_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L24)
```php title="Default value"
$result = run('{{bin/php}} {{release_or_current_path}}/artisan --version');
preg_match_all('/(\d+\.?)+/', $result, $matches);
return $matches[0][0] ?? 5.5;
```
### public_path
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L29)
Overrides [public_path](/docs/recipe/provision/website.md#public_path) from `recipe/provision/website.php`.
```php title="Default value"
'public'
```
## Tasks
### artisan:down
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L92)
Puts the application into maintenance / demo mode.
### artisan:up
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L95)
Brings the application out of maintenance mode.
### artisan:​key:generate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L102)
Sets the application key.
### artisan:passport:keys
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L105)
Creates the encryption keys for API authentication.
### artisan:db:seed
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L112)
Seeds the database with records.
### artisan:migrate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L115)
Runs the database migrations.
### artisan:migrate:fresh
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L118)
Drops all tables and re-run all migrations.
### artisan:migrate:rollback
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L121)
Rollbacks the last database migration.
### artisan:migrate:status
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L124)
Shows the status of each migration.
### artisan:cache:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L131)
Flushes the application cache.
### artisan:config:cache
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L134)
Creates a cache file for faster configuration loading.
### artisan:config:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L137)
Removes the configuration cache file.
### artisan:event:cache
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L140)
Discovers and cache the application\'s events and listeners.
### artisan:event:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L143)
Clears all cached events and listeners.
### artisan:event:list
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L146)
Lists the application\'s events and listeners.
### artisan:optimize
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L149)
Cache the framework bootstrap files.
### artisan:optimize:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L152)
Removes the cached bootstrap files.
### artisan:route:cache
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L155)
Creates a route cache file for faster route registration.
### artisan:route:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L158)
Removes the route cache file.
### artisan:route:list
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L161)
Lists all registered routes.
### artisan:storage:link
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L164)
Creates the symbolic links configured for the application.
### artisan:view:cache
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L167)
Compiles all of the application\'s Blade templates.
### artisan:view:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L170)
Clears all compiled view files.
### artisan:queue:failed
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L177)
Lists all of the failed queue jobs.
### artisan:queue:flush
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L180)
Flushes all of the failed queue jobs.
### artisan:queue:restart
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L183)
Restarts queue worker daemons after their current job.
### artisan:horizon
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L186)
Starts a master supervisor in the foreground.
### artisan:horizon:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L189)
Deletes all of the jobs from the specified queue.
### artisan:horizon:continue
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L192)
Instructs the master supervisor to continue processing jobs.
### artisan:horizon:list
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L195)
Lists all of the deployed machines.
### artisan:horizon:pause
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L198)
Pauses the master supervisor.
### artisan:horizon:purge
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L201)
Terminates any rogue Horizon processes.
### artisan:horizon:status
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L204)
Gets the current status of Horizon.
### artisan:horizon:terminate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L207)
Terminates the master supervisor so it can be restarted.
### artisan:horizon:publish
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L210)
Publish all of the Horizon resources.
### artisan:​telescope:clear
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L217)
Clears all entries from Telescope.
### artisan:​telescope:prune
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L220)
Prunes stale entries from the Telescope database.
### artisan:octane
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L227)
Starts the octane server.
### artisan:octane:reload
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L230)
Reloads the octane server.
### artisan:octane:stop
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L233)
Stops the octane server.
### artisan:octane:status
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L236)
Check the status of the octane server.
### artisan:nova:publish
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L243)
Publish all of the Laravel Nova resources.
### artisan:pulse:check
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L250)
Starts the Pulse server.
### artisan:pulse:restart
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L253)
Restarts the Pulse server.
### artisan:pulse:purge
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L256)
Purges all Pulse data from storage.
### artisan:pulse:work
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L259)
Process incoming Pulse data from the ingest stream.
### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L265)
Deploys your project.
Main deploy task.
This task is group task which contains next tasks:
* [deploy:prepare](/docs/recipe/common.md#deployprepare)
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors)
* [artisan:storage:link](/docs/recipe/laravel.md#artisanstoragelink)
* [artisan:config:cache](/docs/recipe/laravel.md#artisanconfigcache)
* [artisan:route:cache](/docs/recipe/laravel.md#artisanroutecache)
* [artisan:view:cache](/docs/recipe/laravel.md#artisanviewcache)
* [artisan:event:cache](/docs/recipe/laravel.md#artisaneventcache)
* [artisan:migrate](/docs/recipe/laravel.md#artisanmigrate)
* [deploy:publish](/docs/recipe/common.md#deploypublish)