Laravel Tutorials / September 09, 2014

Deploy with Git and Laravel

Sitepoint has a new article on deploying with Git and Laravel:

I wanted something that was as easy as pushing a repository with Git. More important, I wanted to be in full control when pushing content live. I was able to find a similar workflow that used Git to handle the file transferring. On top of that I found out I could also use the PHP framework Laravel to automate the more repetitive tasks.

This is an interesting solution to the problem and it’s worth reading. This is where Laravel Forge really shines by having automatic deploys. Also don’t forget about Envoy which is designed for this as well, granted it’s not automatic but super easy with the envoy run ... command.

Here is one of our commands for staging which shows an easy way of deploying a specific branch:

@task('dev', ['on' => ['dev']])
    php artisan migrate:reset
    git fetch origin
    git checkout origin/{{ $branch or 'develop' }} --detach
    composer install -o
    php artisan migrate --seed

The usage would be: envoy run dev --branch=feature/test

Laravel News Partners


Join the weekly newsletter and never miss out on new tips, tutorials, and more.