Skip to content

Virakal/GuzzleBundle

 
 

Repository files navigation

Symfony GuzzleBundle Latest Stable Version Total Downloads License

knpbundles.com SensioLabsInsight

This bundle integrates Guzzle 5.x into Symfony. Guzzle is a PHP framework for building RESTful web service clients. It comes with a WSSE Auth Plugin that can be used optionally.

GuzzleBundle follows semantic versioning. Read more on semver.org.

Requirements

Installation

To install this bundle, run the command below and you will get the latest version by Packagist.

composer require eightpoints/guzzle-bundle

To use the newest (maybe unstable) version please add following into your composer.json:

{
    "require": {
        "eightpoints/guzzle-bundle": "dev-master"
    }
}

Usage

Load bundle in AppKernel.php:

new EightPoints\Bundle\GuzzleBundle\GuzzleBundle()

Configuration in config.yml:

guzzle:
    base_url: "http://api.domain.tld"

    # custom headers
    headers:
        Accept: "application/json"

    # plugin settings
    plugin:
       wsse:
           username: acme
           password: pa55w0rd

All these settings are optional. If WSSE username is defined the WSSE plugin will be injected automatically.

Using services in controller:

$client   = $this->get('guzzle.client');
$response = $client->get('/users');

Features

Symfony Debug Toolbar / Profiler

Debug Logs

Suggestions

Adding aliases: If you want to use different names for provided services you can use aliases. This is a good idea if you don't want have any dependency to guzzle in your service name.

services:
   http.client:
       alias: guzzle.client

Authors

See also the list of contributors who participated in this project.

License

This bundle is released under the MIT license

About

Integrates Guzzle into Symfony2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 81.6%
  • HTML 18.4%