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 72<br />

1 "jasonlewis/resource-watcher" : "dev-master"<br />

.<br />

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

Once these requirements are added to the composer.json file, we need to update the vendor folder:<br />

1 composer update<br />

We’ll look at how to integrate these into our deployment workflow shortly.<br />

Environment Commands<br />

Environments are a small, yet powerful, aspect of any Laravel 4 application. They primarily allow<br />

the specification of machine-based configuration options.<br />

There are a few things you need to know about environments, in Laravel 4:<br />

1. The files contained in the root of app/config are merged or overridden by environment-based<br />

configuration files.<br />

2. Configuration files that are specific to an environment are stored in folders matching their<br />

environment name.<br />

3. Environments are determined by an array specified in bootstrap/start.php and are matched<br />

according to the name of the machine on which the application is being run.<br />

4. An application can have any number of environments; each with their own configuration<br />

files. There can also be multiple machine names (hosts) in each environment. You can have<br />

two staging servers, a production server and a testing server (for instance). If their machine<br />

names match those in bootstrap/start.php then their individual configuration files will be<br />

loaded.<br />

5. All Artisan commands can be given an –env option which will override the environment<br />

settings of the machine on which the commands are run. I’m sure there are other ways in<br />

which environments affect application execution, but you get the point: environments are a<br />

big-little thing.<br />

Checking Environments<br />

As I mentioned earlier; environments are usually specified in boostrap/start.php. This is probably<br />

going to be ok for the 99% of Laravel 4 applications that will ever be made, but we can improve upon<br />

it slightly still.

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

Saved successfully!

Ooh no, something went wrong!