Skip to main content
Version: 7.x

How to Deploy a Laravel Project

require 'recipe/laravel.php';

Source

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.

The deploy task of Laravel consists of:

The laravel recipe is based on the common recipe.

Configuration

shared_dirs

Source

Overrides shared_dirs from recipe/deploy/shared.php.

Default value
['storage']

shared_files

Source

Overrides shared_files from recipe/deploy/shared.php.

Default value
['.env']

writable_dirs

Source

Overrides writable_dirs from recipe/deploy/writable.php.

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

Default value
'storage/logs/*.log'

laravel_version

Source

Default value
$result = run('{{bin/php}} {{release_or_current_path}}/artisan --version');
preg_match_all('/(\d+\.?)+/', $result, $matches);
return $matches[0][0] ?? 5.5;

Tasks

artisan:down

Source

Puts the application into maintenance / demo mode.

artisan:up

Source

Brings the application out of maintenance mode.

artisan:key:generate

Source

Sets the application key.

artisan:passport:keys

Source

Creates the encryption keys for API authentication.

artisan:db:seed

Source

Seeds the database with records.

artisan:migrate

Source

Runs the database migrations.

artisan:migrate:fresh

Source

Drops all tables and re-run all migrations.

artisan:migrate:rollback

Source

Rollbacks the last database migration.

artisan:migrate:status

Source

Shows the status of each migration.

artisan:cache:clear

Source

Flushes the application cache.

artisan:config:cache

Source

Creates a cache file for faster configuration loading.

artisan:config:clear

Source

Removes the configuration cache file.

artisan:event:cache

Source

Discovers and cache the application\'s events and listeners.

artisan:event:clear

Source

Clears all cached events and listeners.

artisan:event:list

Source

Lists the application\'s events and listeners.

artisan:optimize

Source

Cache the framework bootstrap files.

artisan:optimize:clear

Source

Removes the cached bootstrap files.

artisan:route:cache

Source

Creates a route cache file for faster route registration.

artisan:route:clear

Source

Removes the route cache file.

artisan:route:list

Source

Lists all registered routes.

Source

Creates the symbolic links configured for the application.

artisan:view:cache

Source

Compiles all of the application\'s Blade templates.

artisan:view:clear

Source

Clears all compiled view files.

artisan:queue:failed

Source

Lists all of the failed queue jobs.

artisan:queue:flush

Source

Flushes all of the failed queue jobs.

artisan:queue:restart

Source

Restarts queue worker daemons after their current job.

artisan:horizon

Source

Starts a master supervisor in the foreground.

artisan:horizon:clear

Source

Deletes all of the jobs from the specified queue.

artisan:horizon:continue

Source

Instructs the master supervisor to continue processing jobs.

artisan:horizon:list

Source

Lists all of the deployed machines.

artisan:horizon:pause

Source

Pauses the master supervisor.

artisan:horizon:purge

Source

Terminates any rogue Horizon processes.

artisan:horizon:status

Source

Gets the current status of Horizon.

artisan:horizon:terminate

Source

Terminates the master supervisor so it can be restarted.

artisan:telescope:clear

Source

Clears all entries from Telescope.

artisan:telescope:prune

Source

Prunes stale entries from the Telescope database.

artisan:octane

Source

Starts the octane server.

artisan:octane:reload

Source

Reloads the octane server.

artisan:octane:stop

Source

Stops the octane server.

artisan:octane:status

Source

Check the status of the octane server.

deploy

Source

Deploys your project.

Main deploy task.

This task is group task which contains next tasks: