11.08.2017 Views

codebright

Create successful ePaper yourself

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

The Primers 17<br />

1 "role": "Genius"<br />

The role option defines the author’s role within the project. For example, developer, designer, or<br />

even sock puppetry artist. If you can’t think of something accurate then put something funny.<br />

That’s all you need to describe your package, now let’s look at something more interesting.<br />

Dependency management!<br />

Dependency Management<br />

You have a box that will contain the X-Men. Only there aren’t a lot of mutants in that box yet. To<br />

build a great superhero team (application) you will need to enlist the support of other mutants (3rd<br />

party dependencies). Let’s have a look at how Composer will help us accomplish this.<br />

1 {<br />

2 "name": "marvel/xmen",<br />

3 "description": "Mutants saving the world for people who hate them."<br />

4 "keywords": ["mutant", "superhero", "bald", "guy"],<br />

5 "homepage": "http://marvel.com/xmen",<br />

6 "time": "1963-09-01",<br />

7 "license": "MIT",<br />

8 "authors": [<br />

9 {<br />

10 "name": "Stan Lee",<br />

11 "email": "stan@marvel.com",<br />

12 "homepage": "http://marvel.com",<br />

13 "role": "Genius"<br />

14 }<br />

15 ],<br />

16 "require": {<br />

17<br />

18 }<br />

19 }<br />

We now have a new section within our composer.json called require. This will be used to list our<br />

dependenc… mutants. From now on I’ll be omitting the rest of the configuration, and just showing<br />

the require block to shorten the examples. Make sure you know where it really lives though!<br />

We know that the X-Men will depend on:<br />

• Wolverine<br />

• Cyclops

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

Saved successfully!

Ooh no, something went wrong!