What is the difference between Symfony2 and a compatible PSR-0 third-party library?

I understand that a package should contain a directory structure and other conventions described in the best practice documentation .

I still don't understand why I have to choose between installing the library as a package or just installing the library compatible with PSR-0 β€œas is” in the Symfony2 installation.

For example, I want to install the Guzzle Http Client library. I currently have two versions to choose from:

I can see that the package uses the library, but since I'm new to Symfony2, I still can’t understand the big picture. Can someone help me?

+4
source share
1 answer

Using a package instead of a library will allow you to access the library from the ServiceContainer.

This will allow you to easily call the library; for example, in the controller:

<?php public function someAction(){ // ... $guzzle = $this->get('guzzle.service_builder'); // ... } 

check out http://symfony.com/doc/current/book/service_container.html

+2
source

All Articles