Deploy with Git and Laravel
Published on by Eric L. Barnes
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']]) cd site.com 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
Eric is the creator of Laravel News and has been covering Laravel since 2012.