A Symfony2 bundle for integrating Guzzle, a PHP framework for building RESTful web service clients
PHP
Switch branches/tags
Nothing to show
Pull request Compare This branch is 12 commits ahead, 17 commits behind ddeboer:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
DependencyInjection
Resources/config
Tests
.gitignore
GuzzleGuzzleBundle.php
README.markdown
composer.json
phpunit.xml.dist

README.markdown

Introduction

GuzzleBundle is a Symfony2 bundle for integrating the Guzzle PHP library in your project.

It’s not quite finished.

Installation

  1. 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
    
  2. 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
     ));
    
  3. Add this bundle to your application's kernel:

     // app/AppKernel.php
     public function registerBundles()
     {
         // ...
         new Guzzle\GuzzleBundle\GuzzleGuzzleBundle(),
         // ...
     }
    
  4. 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: ~
    
  5. And add a Guzzle clients configuration file. See the Guzzle documentation.

    // app/config/guzzleclients.xml

Usage

In any of your app controller, use the service builder to instantiate a client:

    $serviceBuilder = $this->get('guzzle.service_builder');
    $client = $serviceBuilder->get('unfuddle');