PHPackages                             morphatic/laravel-auto-deploy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. morphatic/laravel-auto-deploy

AbandonedArchivedLibrary[DevOps &amp; Deployment](/categories/devops)

morphatic/laravel-auto-deploy
=============================

Add push-to-deploy capability to your Laravel project

v0.1.0(10y ago)11331MITPHPPHP &gt;=5.6.0

Since Dec 4Pushed 10y ago2 watchersCompare

[ Source](https://github.com/morphatic/laravel-auto-deploy)[ Packagist](https://packagist.org/packages/morphatic/laravel-auto-deploy)[ RSS](/packages/morphatic-laravel-auto-deploy/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Laravel Auto-Deploy
===================

[](#laravel-auto-deploy)

[![Build Status](https://camo.githubusercontent.com/c8fcfed4fefb0a94fa80be5fd9d32b828e3880608d2cd3cf915e4cc6ad595472/68747470733a2f2f7472617669732d63692e6f72672f6d6f727068617469632f6c61726176656c2d6175746f2d6465706c6f792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/morphatic/laravel-auto-deploy) [![Coverage Status](https://camo.githubusercontent.com/400c7bb0b88de3aa2b877b9be25faa87c1d26afc9a32997c91daaa8957b8fd13/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6d6f727068617469632f6c61726176656c2d6175746f2d6465706c6f792f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/morphatic/laravel-auto-deploy?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/28d467853972cb2db5f0b300795e15ecc1cf6ae24b16e36b1d6c8530d1f14656/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6f727068617469632f6c61726176656c2d6175746f2d6465706c6f792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/morphatic/laravel-auto-deploy/?branch=master) [![Dependency Status](https://camo.githubusercontent.com/83733ea8c5664a49c033233b2820b2919a09c8268518e0137483db0fca22f7bc/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3536356538343263663337366363303033633030303030312f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/565e842cf376cc003c000001) [![Latest Stable Version](https://camo.githubusercontent.com/c01c65940c20240962c892bd34a4dbbfa699bf2a3a97d94693927d3d7aafb4ec/68747470733a2f2f706f7365722e707567782e6f72672f6d6f727068617469632f6c61726176656c2d6175746f2d6465706c6f792f762f737461626c65)](https://packagist.org/packages/morphatic/laravel-auto-deploy) [![Total Downloads](https://camo.githubusercontent.com/2038af7b247ef1c4696e5ce50306dc80c57a9e7f698bf532a392173daf45c5c5/68747470733a2f2f706f7365722e707567782e6f72672f6d6f727068617469632f6c61726176656c2d6175746f2d6465706c6f792f646f776e6c6f616473)](https://packagist.org/packages/morphatic/laravel-auto-deploy) [![Latest Unstable Version](https://camo.githubusercontent.com/f38c0448887151688d812ed6b7e158a903da6fd40905eff2f3a5ebb121cdd0d4/68747470733a2f2f706f7365722e707567782e6f72672f6d6f727068617469632f6c61726176656c2d6175746f2d6465706c6f792f762f756e737461626c65)](https://packagist.org/packages/morphatic/laravel-auto-deploy) [![License](https://camo.githubusercontent.com/329582ddb2a74425014ac9b7073d321bc5b185476011d7420af2f58dad6edc86/68747470733a2f2f706f7365722e707567782e6f72672f6d6f727068617469632f6c61726176656c2d6175746f2d6465706c6f792f6c6963656e7365)](https://packagist.org/packages/morphatic/laravel-auto-deploy)

Warning! 2015-12-03
-------------------

[](#warning-2015-12-03)

This package is VERY new and has NOT been fully tested. USE AT YOUR OWN RISK!

I will remove this warning after I've tested it a bit more. Please feel free to try it out, but I'd strongly recommend doing it in a testing or staging environment. I'd love feedback. Please [submit issues here](/morphatic/laravel-auto-deploy/issues).

This package will add push-to-deploy functionality to your Laravel 5.1 project. This means, that whenever you push changes to your project's Github repository, a secure notification will be sent to your server which will initiate a sequence of commands to:

1. Create a snapshot of your project database
2. Create a new deploy folder next to your existing one
3. Pull the latest commit from your Github repo to your server
4. Copy your `.env` file over from the latest version
5. Run `composer self-update && composer update`
6. Run `npm update`
7. Run `php artisan migrate`
8. Seed your database
9. Symlink the new deploy directory to be your webroot
10. Log all changes and send you an email
11. Abort and roll back any changes in the event of an error
12. Do all of the above immediately, (in the future) or at a set time, say 2AM when few people are likely to be using your app

In other words, it will automatically execute all the steps you would normally perform manually when deploying changes to a live website. Most of the steps are configurable, and a number are optional. The idea is to create one or more automatic deployment scripts that will fit various scenarios for your project.

Installation
------------

[](#installation)

### Pre-requisites

[](#pre-requisites)

This package is designed to work with Laravel 5.1 and has not been tested with other versions. It has only been tested in an Ubuntu 14.04 (Trusty)/Nginx setup. It is **strongly recommended** that you set up an SSL certificate for your site so that Github can send requests securely. If you don't have an SSL cert, [**you can get one for free at Let's Encrypt!**](https://letsencrypt.org) It is possible to use a self-signed certificate with Github webhooks by clicking on the "Disable SSL verification" button when setting up the webhook. That being said, getting an SSL certificate from a registered CA is highly recommended. Since they're free now, you really have no excuse!

### Step 1: Modify `composer.json`

[](#step-1-modify-composerjson)

You have two options. The first option is to open the `composer.json` file in the root of your project and add the following to your `require` array:

```
"morphatic/laravel-auto-deploy": "dev-master"

```

After doing this, open up a terminal session (command prompt), navigate to the root of your project, and type `composer update`. This will install the package in your vendor folder.

The second option is to open up a terminal session, navigate to the root of your project and type the command:

```
composer require "morphatic/laravel-auto-deploy=dev-master"

```

If all went well, the `post-install-cmd` should have created an `auto-deploy.php` file to your `config/` directory. It should also have modified your `.env` file to add two unique, random keys to your environment variables. **NEVER publish these keys in a public location! If you do, you increase the risk that a malicious agent could trigger site deployments arbitrarily.** After this is done, there should be a message displayed on your terminal that has the information you'll need in [Step 4](#step4) to create your webhook at Github. You may want to complete that step before closing or clearing the terminal.

### Step 2: Add `ServiceProvider` to `config/app.php`

[](#step-2-add-serviceprovider-to-configappphp)

In your favorite code editor, open up the `config/app.php` file and add the following to the `'providers'` array:

```
Morphatic\AutoDeploy\AutoDeployServiceProvider::class,

```

### Step 3: Modify `App\Http\Middleware\VerifyCsrfToken`

[](#step-3-modify-apphttpmiddlewareverifycsrftoken)

Open up the file `app/Http/Middleware/VerifyCsrfToken.php`. In order for this package to work, you have to tell Laravel not to try to verify the CSRF token for the webhook requests that trigger deploys. The only way to do this securely without publishing your keys in a public location is to override the `__construct()` method of the `VerifyCsrfToken` class. Add the code below somewhere inside this class:

```
public function __construct(Illuminate\Contracts\Encryption\Encrypter $encrypter)
{
    parent::__construct($encrypter);
    $this->except[] = config('auto-deploy.route');
}

```

If by some chance you already had a `__construct()` method in this class, just make sure that the second line, which adds the secret URL to list of URLs exempted from CSRF token verification, gets added to the class. That line looks like:

```
$this->except[] = config('auto-deploy.route');

```

### Step 4: Set up webhook at Github

[](#step-4-set-up-webhook-at-github)

Go to the main page for your repository at Github and click on "Settings" &gt; "Webhooks &amp; services" then in the Webhooks box, click on the "Add webhook" button. A form like the one pictured below will appear. You should fill out this form with the "Payload URL" and "Secret" that were displayed in the terminal during [Step 1](#step1). If you already closed or cleared the terminal, you can re-display this information by opening up a terminal session, navigating to your project's root directory and running `php artisan deploy:info`.

[![Github webhook registration screen](https://camo.githubusercontent.com/5328ffcb18f2c7c3cff28ae6604b5c969dcb5c716a81f9d4f83abe708badc226/687474703a2f2f692e737461636b2e696d6775722e636f6d2f366d5049792e706e67)](http://i.stack.imgur.com/6mPIy.png)

Note that it is **highly recommended** that you set your Payload URL to communicate with your site over SSL (i.e. using `https`). Even using a self-signed certificate and clicking the button to "Disable SSL verification" is better than sending the data unencrypted across the web.

In the lower half of the form, you are asked "Which events would you like to trigger this webhook?" The supported events are Push, Create and Release. Of course you may select others, but any requests sent to your site triggered by those events will be ignored by this package.

If the server you're deploying to is a **staging** server, then you might want to subscribe to Push events. If it's a **production** server, you might just want to subscribe to Release events. It's up to you. We'll configure how your server responds to the webhook requests in the next step.

### Step 5: Configure Your Deployment(s)

[](#step-5-configure-your-deployments)

Open up `config/auto-deploy.php` in your favortie code editor. Scroll down to the `'events'` array and add/edit them as meets the needs of your deployment environment. There should be ample documentation within this file to make the necessary changes.

### Step 6: Testing

[](#step-6-testing)

It should go without saying, you should absolutely test this out in a non-critical environment before using it in anything close to a production environment. Good luck!

License and Disclaimer
----------------------

[](#license-and-disclaimer)

Copyright (c) 2015 Morgan C. Benton, this package is released under the [MIT License](LICENSE)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3861d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75217e000b3195793db8cda685719446fa9969cc33f48cc5445fb3c9359a8df7?d=identicon)[morphatic](/maintainers/morphatic)

---

Top Contributors

[![morphatic](https://avatars.githubusercontent.com/u/467980?v=4)](https://github.com/morphatic "morphatic (41 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

laravelgitdeploypush-to-deploy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/morphatic-laravel-auto-deploy/health.svg)

```
[![Health](https://phpackages.com/badges/morphatic-laravel-auto-deploy/health.svg)](https://phpackages.com/packages/morphatic-laravel-auto-deploy)
```

###  Alternatives

[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2821.5M8](/packages/spatie-laravel-prometheus)[alegiac/laravel-release-manager

Automated release management for Laravel packages with Conventional Commits support

141.2k](/packages/alegiac-laravel-release-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
