Travis CI – Laravel Forge / webhook integration

While developing tests for my app, I wanted to have an integration with Laravel Forge in this order:

  1. Push to Github after commit
  2. Tests done by Travis CI
  3. Call the deployment trigger url of Laravel Forge / Envoyer if the test runs successfully. This URL looks like:

To do this, create a travis.yml file like:

language: php

  - 7.1

  - cp .env.travis .env
  - mysql -e 'create database db_testing';
  - composer self-update
  - composer install --no-interaction
  - php artisan migrate

  - vendor/bin/phpunit

  - chmod +x ./; ./

Don’t forget to change the environment in phpunit.xml for example to change to a custom database:

The after_success script

Create a file and insert:


# Trigger deployment
# Replace the url below with your Forge/Laravel url
curl -s '';
echo 'Deployment triggered!'


Using other services than Travis or creating a custom test service

Also thanks to: