Skip to content

A Symfony2 bundle for integrating Guzzle, a PHP framework for building RESTful web service clients

Notifications You must be signed in to change notification settings

adrianmoya/GuzzleBundle

 
 

Repository files navigation

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');

About

A Symfony2 bundle for integrating Guzzle, a PHP framework for building RESTful web service clients

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%