• Home
  • blog
  • How Can I Use Laravel Envoyer or Deployer with SemaphoreCI?

How Can I Use Laravel Envoyer or Deployer with SemaphoreCI?

Test automation, continuous integration, and continuous delivery are quite widespread in the community now. This brought to life multiple services trying to make the process more enjoyable and less overwhelming for developers, so they can focus on delivering software instead of building/configuring tools to do that. One of those services is SemaphoreCI.

In this article, we’re going to cover how to use our own deploy scripts and tools to continue the deployment process after a successful test.

We will be using SemaphoreCI for continuous delivery and Deployer to push our code to the DigitalOcean production server. If you’re not familiar with Deployer, we recommend you check out this introduction.

Combination of SemaphoreCI and Deployer logos

Demo Application

We’ll be using a 500px application that loads photos from the marketplace. It was built using Laravel and you can read the full article about its building process here, and find the repo on GitHub.

Creating a Deployer Script

The way Deployer works is by us defining servers, and then creating tasks that handle the process of deploying the application to those servers. Our deploy.php script looks like this:


require_once "recipe/common.php";

set('ssh_type', 'native');
set('default_stage', 'staging');
env('deploy_path', '/var/www');
env('composer_options', 'install --no-dev --prefer-dist --optimize-autoloader --no-progress --no-interaction');
set('copy_dirs', [

set('shared_dirs', [
set('writable_dirs', get('shared_dirs'));
set('http_user', 'www-data');

server('digitalocean', '')

task('deploy:upload', function() {
    $files = get('copy_dirs');
    $releasePath = env('release_path');

    foreach ($files as $file)
        upload($file, "{$releasePath}/{$file}");

task('deploy:staging', [
    'current',// print current release number
])->desc('Deploy application to staging.');

after('deploy:staging', 'success');

You should read the Deployer article if you’d like to learn more about what this specific script does. Our next step is to set up a SemaphoreCI project. Please read the crash course article if you’ve never tried SemaphoreCI before, and do that.

Continue reading %How Can I Use Laravel Envoyer or Deployer with SemaphoreCI?%