03.12.2015 Views

laravel4cookbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Packages 166<br />

Publishing Configuration Files<br />

Often you’ll want to add new configuration files to the collection which ship with new Laravel<br />

applications. There’s an artisan command to help with this:<br />

1 php artisan config:publish formativ/deployment --path=workbench/Formativ/Deployme\<br />

2 nt/src/config<br />

This should copy the package configuration files into the app/config/packages/formativ/deployment<br />

directory.<br />

.<br />

Since we have access to a whole new kind of configuration; we no longer need to override the<br />

configuration files for things like environment. As long as our helpers/macros use the package<br />

configuration files instead of the the default ones; we can leave the underlying Laravel 4 application<br />

structure (and bootstrapping code) untouched.<br />

Creating Composer.json<br />

Before we can publish our package, so that others can use it in their applications; we need to add a<br />

few things to the composer.json file that the workbench command created for us:<br />

1 {<br />

2 "name" : "formativ/deployment",<br />

3 "description" : "All sorts of cool things with deployment.",<br />

4 "authors" : [<br />

5 {<br />

6 "name" : "Christopher Pitt",<br />

7 "email" : "cgpitt@gmail.com"<br />

8 }<br />

9 ],<br />

10 "require" : {<br />

11 "php" : ">=5.4.0",<br />

12 "illuminate/support" : "4.0.x"<br />

13 },<br />

14 "autoload" : {<br />

15 "psr-0" : {<br />

16 "Formativ\\Deployment" : "src/"<br />

17 }

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

Saved successfully!

Ooh no, something went wrong!