Autor wpisu: Kamil Adryjanek, dodany: 11.10.2012 13:27, tagi: symfony2, php
Composer is a amazing tool for dependency managment in PHP. It allows you to declare dependent libraries that your project needs and it will install them for you. You can find more information on official composer website.
To install package that already exists in PHP Package archivist we need to add just simple line of code:
File composer.json (in this example to install Doctrine extensions):
<br />
"require": {<br />
gedmo/doctrine-extensions": "master-dev",<br />
}<br />
But what about libraries that are not composer aware? Still many bundles don't have composer.json. The proper way to install them with composer is (this solution is much more better than installing it via deps file):
In composer.json file we need to add repositores section:
<br />
"repositories": [<br />
{<br />
"type": "package",<br />
"package": {<br />
"name": "makerlabs/pager-bundle",<br />
<div style="display: none"><a href='http://buyingvviagra.com/'>online viagra</a></div> "version": "master",<br />
"target-dir": "MakerLabs/PagerBundle",<br />
"source": {<br />
"url": "https://github.com/makerlabs/PagerBundle",<br />
"type": "git",<br />
"reference": "master"<br />
},<br />
"autoload": {<br />
"psr-0": {<br />
"MakerLabs\\PagerBundle": ""<br />
}<br />
}<br />
}<br />
}<br />
],<br />
And then just:
<br />
"require": {<br />
"makerlabs/pager-bundle": "master"<br />
}<br />
In this example i'm installing simple but usefull PagerBundle component from MakerLabs:
Kanał ATOM

Nie wiem czy znacie? Bez przesady, jak można nie znać Ilia Alshanetsky. Od ponad 10 lat rozwija PHP, prowadzi świetne prezentacje. A najważniejsze: tworzy świetne materiały prezentacyjne.