GuzzleBundle is a Symfony2 bundle for integrating the Guzzle PHP library in your project.
It’s not quite finished.
-
Install Guzzle and GuzzleBundle as a Git submodule:
$ git submodule add git://github.com/guzzle/guzzle.git vendor/guzzle/guzzle $ git submodule add git://github.com/guzzle/GuzzleBundle vendor/bundles/Guzzle/GuzzleBundle
Or configure your
deps
to include the bundle:[Guzzle] git=git://github.com/guzzle/guzzle.git target=guzzle/guzzle [GuzzleBundle] git=git://github.com/guzzle/GuzzleBundle.git target=bundles/Guzzle/GuzzleBundle
-
Add the Guzzle and GuzzleBundle namespace to your autoloader:
// app/autoload.php $loader->registerNamespaces(array( 'Guzzle\\GuzzleBundle' => __DIR__.'/../vendor/bundles', 'Guzzle' => __DIR__.'/../vendor/guzzle/guzzle/src', // your other namespaces ));
-
Add this bundle to your application's kernel:
// app/AppKernel.php public function registerBundles() { // ... new Guzzle\GuzzleBundle\GuzzleGuzzleBundle(), // ... }
-
Configure the
service_builder
service, and ensure that the framework is using the filesystem for session storage:# app/config/config.yml guzzle_guzzle: service_builder: ~
-
And add a Guzzle clients configuration file. See the Guzzle documentation.
// app/config/guzzleclients.xml
In any of your app controller, use the service builder to instantiate a client:
$serviceBuilder = $this->get('guzzle.service_builder');
$client = $serviceBuilder->get('unfuddle');