Laravel Envoy

Run deployment tasks and automation with a simple Blade-like syntax.

Demo

A simple demo using Laravel Envoy.

Laravel Envoy provides a clean, minimal syntax for defining common tasks you run on your remote servers. It uses a Blade-like Envoy.blade.php file to define servers and tasks, and can be used for deployment pipelines or any repeatable automation.

Realtime Envoy Demo

Click the button below to run an actual Envoy task on this server. Output is captured and streamed live to your browser via WebSockets.

Run ID: 89ebf97a-f905-489c-9a67-8bc82ddf9497
Ready. Click "Run Envoy Task" to start…

Show Your Working

A quick walkthrough of how this works.

Installation

Install Envoy globally via Composer:

composer global require laravel/envoy

Create Envoy.blade.php

The demo on this page uses the following Envoy.blade.php file, which runs a safe, simulated deploy with small random delays between steps:

@servers(['local' => '127.0.0.1'])

@task('demo', ['on' => 'local'])
    echo "🚀 Starting simulated deployment..."
    sleep 1

    echo "📥 Pulling latest changes from git..."
    sleep $(php -r 'echo random_int(1,2);')

    echo "📦 Installing composer dependencies..."
    sleep $(php -r 'echo random_int(2,4);')

    echo "🗄️ Running database migrations..."
    sleep $(php -r 'echo random_int(1,2);')

    echo "🧹 Clearing and optimizing configuration..."
    php artisan optimize:clear
    sleep 1

    echo "🖥️ System info:"
    uname -srm

    echo "✅ Deployment finished successfully!"
    echo "-----------------------------------"
    echo "User: $(whoami)"
    echo "Time: $(date +'%Y-%m-%d %H:%M:%S %Z')"
@endtask 

Run a Task

From the project root, you can run the task using the envoy run command:

envoy run demo
# or
vendor/bin/envoy run demo

Tips

  • @setup can be used to prepare variables and PHP logic.
  • Use @story to chain tasks into pipelines.
  • Define multiple servers and target them with the on option.
  • Keep secrets in environment variables or your CI system; avoid hardcoding credentials.

Resource Links

A few links to supporting resources.