03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Deployment<br />

There are few things which have improved my life quite as much as learning how to create a custom<br />

deployment process for my projects. Nothing is worse than having to worry about how to get your<br />

files onto a remote server, when you’ve got an important bug to fix.<br />

.<br />

The code for this chapter can be found at: https://github.com/formativ/tutorial-laravel-4-<br />

deployment<br />

Deployment processes are one of the most subjective things about development. Everyone’s got their<br />

own ideas about what should and shouldn’t be done. There are sometimes best practises; though<br />

these tend only to apply to subsets of the whole process.<br />

Things get even more tricky when it comes to deploying Laravel 4 applications because there aren’t<br />

really any best practises to speak of, when it comes to working with remote servers and deploying<br />

code.<br />

Remember this as you continue — this tutorial isn’t the only approach to deploying Laravel 4<br />

applications. It’s simply a process I’ve found works for me.<br />

Dependencies<br />

Our deployment processes will need to handle JavaScript and CSS files. Assetic is an asset<br />

management library which we will use to do all the heavy lifting in this area.<br />

To install it; we need to add two requirements to our composer.json file:<br />

1 "kriswallsmith/assetic" : "1.2.*@dev",<br />

2 "toopay/assetic-minifier" : "dev-master"<br />

.<br />

This was extracted from composer.json.<br />

Lastly, we will also be using Jason Lewis’ Resource Watcher library, which integrates with Laravel<br />

4’s Filesystem classes to enable notification of file changes. You’ll see why that’s useful in a bit…

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!