Laravel 5.4
Awesome Laravel
- Awesome Laravel (Chirag Gude)
 Prologue
- Release Notes
 - Upgrade Guide
 Getting Started
- Installation
 - Configuration
 - Directory Structure
 - Laravel Homestead
 - valet
 Architecture Concepts
- Request Lifecycle
 - Service Container
 - Service Providers
 - Facades
 The Basics
- Routing
 - Errors & Logging
 - Middleware
 - CSRF Protection
 - Controllers
 - HTTP Requests
 - HTTP Responses
 - Views
 - HTTP Session
 - Validation
 Frontend
- Blade Templates
 - Localization
 - JavaScript & CSS Scaffolding
 - Compiling Assets (Laravel Mix)
 Security
- Authentication
 - API Authentication (Passport)
 - Authorization
 - Encryption
 - Hashing
 - Resetting Passwords
 Digging Deeper
- Artisan Console
 - Queues
 - Package Development
 - Task Scheduling
 - Broadcasting
 - Cache
 - Collections
 - Events
 - File Storage
 - helpers
 - Notifications
 Database
- Database Getting Started
 - Database Query Builder
 - Database Pagination
 - Database Migrations
 - Database Seeding
 - Redis
 Eloquent ORM
- Eloquent Getting Started
 - Eloquent Relationships
 - Eloquent Collections
 - Eloquent Mutators
 - Eloquent Serialization
 Testing
- Testing Getting Started
 - HTTP Tests
 - Browser Tests (Laravel Dusk)
 - Database Testing
 - Mocking
 - redirect
 Official Packages
- Laravel Cashier
 - Envoy Task Runner
 - Laravel Scout
 
Envoy Task Runner
Introduction
Laravel Envoy provides a clean, minimal syntax for defining common tasks you run on your remote servers. Using Blade style syntax, you can easily setup tasks for deployment, Artisan commands, and more. Currently, Envoy only supports the Mac and Linux operating systems.
Installation
First, install Envoy using the Composer global require command:
Since global Composer libraries can sometimes cause package version conflicts, you may wish to consider using cgr, which is a drop-in replacement for the composer global require command. The cgr library’s installation instructions can be found on GitHub.
{note} Make sure to place the
~/.composer/vendor/bindirectory in your PATH so theenvoyexecutable is found when running theenvoycommand in your terminal.
Updating Envoy
You may also use Composer to keep your Envoy installation up to date. Issuing the composer global update command will update all of your globally installed Composer packages:
Writing Tasks
All of your Envoy tasks should be defined in an Envoy.blade.php file in the root of your project. Here’s an example to get you started:
As you can see, an array of @servers is defined at the top of the file, allowing you to reference these servers in the on option of your task declarations. Within your @task declarations, you should place the Bash code that should run on your server when the task is executed.
You can force a script to run locally by specifying the server’s IP address as 127.0.0.1:
Setup
Sometimes, you may need to execute some PHP code before executing your Envoy tasks. You may use the 
If you need to require other PHP files before your task is executed, you may use the @include directive at the top of your Envoy.blade.php file:
Variables
If needed, you may pass option values into Envoy tasks using the command line:
Stories
Stories group a set of tasks under a single, convenient name, allowing you to group small, focused tasks into large tasks. For instance, a deploy story may run the git and composer tasks by listing the task names within its definition:
Once the story has been written, you may run it just like a typical task:
Multiple Servers
Envoy allows you to easily run a task across multiple servers. First, add additional servers to your @servers declaration. Each server should be assigned a unique name. Once you have defined your additional servers, list each of the servers in the task’s on array:
Parallel Execution
By default, tasks will be executed on each server serially. In other words, a task will finish running on the first server before proceeding to execute on the second server. If you would like to run a task across multiple servers in parallel, add the parallel option to your task declaration:
Running Tasks
To run a task or story that is defined in your Envoy.blade.php file, execute Envoy’s run command, passing the name of the task or story you would like to execute. Envoy will run the task and display the output from the servers as the task is running:
Confirming Task Execution
If you would like to be prompted for confirmation before running a given task on your servers, you should add the confirm directive to your task declaration. This option is particularly useful for destructive operations:
Notifications
Slack
Envoy also supports sending notifications to Slack after each task is executed. The @slack directive accepts a Slack hook URL and a channel name. You may retrieve your webhook URL by creating an “Incoming WebHooks” integration in your Slack control panel. You should pass the entire webhook URL into the @slack directive:
You may provide one of the following as the channel argument:
- To send the notification to a channel:
#channel- To send the notification to a user:
@user