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

mcreenan/GuzzleBundle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GuzzleBundle

Introduction

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

It’s not quite finished.

Installation

Install Guzzle:

git submodule add git:https://github.com/guzzle/guzzle.git vendor/guzzle

Install GuzzleBundle:

git submodule add git:https://github.com/ddeboer/GuzzleBundle vendor/bundles/Ddeboer/GuzzleBundle

Autoloader

Add Guzzle and Ddeboer namespace to your autoloader:

// app/autoload.php
$loader->registerNamespaces(array(
	// ...
	'Guzzle'           => __DIR__.'/../vendor/guzzle/src',
	'Ddeboer'          => __DIR__.'/../vendor/bundles',
	// ...
));

Application kernel

Add GuzzleBundle to your application kernel:

// app/AppKernel.php
public function registerBundles()
{
	// ...
	new Ddeboer\GuzzleBundle\DdeboerGuzzleBundle(),
	// ...
}

Configure the Guzzle service builder

// app/config/config.yml
ddeboer_guzzle: 
  service_builder:
    configuration_file: "%kernel.root_dir%/config/webservices.xml"
    cache: 
      adapter: doctrine
      driver: apc

And add a Guzzle services configuration file. See the Guzzle documentation.

// app/config/webservices.xml
<?xml version="1.0" ?>
<guzzle>
    <clients>
        <!-- Abstract service to store AWS account credentials -->
        <client name="abstract.aws">
            <param name="access_key" value="12345" />
            <param name="secret_key" value="abcd" />
        </client>
        <!-- Amazon S3 client that extends the abstract client -->
        <client name="s3" classs="Guzzle.Aws.S3.S3Client" extends="abstract.aws">
            <param name="devpay_product_token" value="XYZ" />
            <param name="devpay_user_token" value="123" />
        </client>
        <client name="simple_db" class="Guzzle.Aws.SimpleDb.SimpleDbClient" extends="abstract.aws" />
        <client name="sqs" class="Guzzle.Aws.Sqs.SqsClient" extends="abstract.aws" />
        <!-- Unfuddle client -->
        <client name="unfuddle" class="Guzzle.Unfuddle.UnfuddleClient">
            <param name="username" value="test-user" />
            <param name="password" value="my-password" />
            <param name="subdomain" value="my-subdomain" />
        </client>
    </clients>
</guzzle>

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