PHPackages                             orphans/git-deploy-laravel - 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. orphans/git-deploy-laravel

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

orphans/git-deploy-laravel
==========================

Helps automate the deployment of projects onto servers by utilising Git web hooks.

0.5.0(4y ago)335.9k↓50%13[1 PRs](https://github.com/orphans/git-deploy-laravel/pulls)MITPHP

Since Sep 20Pushed 4y ago5 watchersCompare

[ Source](https://github.com/orphans/git-deploy-laravel)[ Packagist](https://packagist.org/packages/orphans/git-deploy-laravel)[ RSS](/packages/orphans-git-deploy-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (7)Used By (0)

Deployment of Laravel projects using Git webhooks
=================================================

[](#deployment-of-laravel-projects-using-git-webhooks)

git-deploy-laravel allows for automated deployment using webhook requests from your repository's server, and automatically pulls project code using the local Git binary.

This should work out-of-the-box with Laravel 5.x using with webhooks from GitHub and GitLab servers.

This is an internal tool to help with our common workflow pattern but please feel free to borrow, change and improve.

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

[](#installation)

### Step 1

[](#step-1)

Add the following to your `composer.json` file then update your composer as normal:

```
{
    "require" : {
        "orphans/git-deploy-laravel" : "dev-master"
    }
}

```

Or run:

```
composer require orphans/git-deploy-laravel

```

### Step 2

[](#step-2)

Add the */git-deploy* route to CSRF exceptions so your repo's host can send messages to your project.

In file in `app/Http/Middleware/VerifyCsrfToken.php` add:

```
protected $except = [
    'git-deploy',
];

```

### Step 3 Optional

[](#step-3-optional)

In case you need additional action after a successful commit, you can add you own Event Listener. For example you can write your own update script to run migrations etc.

**1)** Create a Listener to perform action when a git deployment is done. Open the `App/Listeners` directory (or create it if it doesn't exist). Now create a new file and call it `GitDeployedListener.php`. Paste in this code:

```
