socloz / guzzle-bundle
This Bundle provide integration for guzzle http client to access RESTful API's with Symfony2
Installs: 22 658
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 12
Forks: 29
Type:symfony-bundle
Requires
- php: >=5.3.2
- guzzle/guzzle: 2.8.*
- symfony/symfony: >=2.0,<2.2
This package is not auto-updated.
Last update: 2024-12-15 03:38:55 UTC
README
DdeboerGuzzleBundle is a Symfony2 bundle for integrating the Guzzle PHP library in your project.
Installation
Using composer :
-
Add
socloz/guzzle-bundle
as a dependency in your project'scomposer.json
file:{ "require": { "socloz/guzzle-bundle": "dev-socloz-master", } }
-
Install your dependencies:
php composer.phar update
Enable the bundle
Enable the bundle in the kernel
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Ddeboer\GuzzleBundle\DdeboerGuzzleBundle(), ); }
Configure the bundle
Add a custom service client :
<?php
/*
* Copyright CloseToMe 2011/2012
*/
namespace Acme\ExampleBundle\Webservice;
use Guzzle\Common\Collection;
use Guzzle\Service\Client;
use Guzzle\Service\Description\ServiceDescription;
class MyWebserviceClient extends Client
{
public static function factory($config = array())
{
$client = new self($config['base_url'], $config);
// Add custom setup code
// Attach a service description to the client
$description = ServiceDescription::factory($config);
$client->setDescription($description);
return $client;
}
}
And configure the webservice :
# app/config/config.yml ddeboer_guzzle: service_builder: configuration: Stats: class: "Acme\\ExampleBundle\\Webservice\\MyWebserviceClient" params: operations: OperationName: httpMethod: GET uri: /search parameters: query: location: query required: true type: string sort: location: query type: string
See the Guzzle documentation for more information.
License
This bundle is under the MIT license. See the complete license in the bundle:
Resources/meta/LICENSE