socloz/guzzle-bundle
最新稳定版本:v1.0.0
Composer 安装命令:
composer require socloz/guzzle-bundle
包简介
This Bundle provide integration for guzzle http client to access RESTful API's with Symfony2
README 文档
README
DdeboerGuzzleBundle is a Symfony2 bundle for integrating the Guzzle PHP library in your project.
Installation
Using composer :
-
Add
socloz/guzzle-bundleas a dependency in your project'scomposer.jsonfile:{ "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
统计信息
- 总下载量: 22.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-02-11