PHPackages                             gregurco/guzzle-bundle-wsse-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. gregurco/guzzle-bundle-wsse-plugin

ActiveLibrary[Framework](/categories/framework)

gregurco/guzzle-bundle-wsse-plugin
==================================

WSSE Plugin for Guzzle Bundle, a PHP HTTP client library and framework for building RESTful web service clients

v1.0.2(8y ago)530.0k↓50%4MITPHPPHP ^7.0

Since Oct 26Pushed 8y ago2 watchersCompare

[ Source](https://github.com/gregurco/GuzzleBundleWssePlugin)[ Packagist](https://packagist.org/packages/gregurco/guzzle-bundle-wsse-plugin)[ Docs](https://github.com/gregurco/GuzzleBundleWssePlugin)[ RSS](/packages/gregurco-guzzle-bundle-wsse-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

Guzzle Bundle WSSE Plugin
=========================

[](#guzzle-bundle-wsse-plugin)

[![Build Status](https://camo.githubusercontent.com/f0ff1cd99b276f85d5be6abe475e47fa2a40f0b776424611c00df7c2ffa3594a/68747470733a2f2f7472617669732d63692e6f72672f677265677572636f2f47757a7a6c6542756e646c6557737365506c7567696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gregurco/GuzzleBundleWssePlugin)[![Coverage Status](https://camo.githubusercontent.com/9374a298c87a6deed391daaa548130b5791971a0bd0bf1b123142d3c138c3b59/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f677265677572636f2f47757a7a6c6542756e646c6557737365506c7567696e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/gregurco/GuzzleBundleWssePlugin)[![SensioLabsInsight](https://camo.githubusercontent.com/b90d75863edee8de818fc669e3d709750a06d4de92737ae3d536fe53043f33c7/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f35333736363063332d393133612d346365322d383736612d3461626237336636343266322f6d696e692e706e67)](https://insight.sensiolabs.com/projects/537660c3-913a-4ce2-876a-4abb73f642f2)

This plugin integrates [WSSE](http://www.xml.com/pub/a/2003/12/17/dive.html) functionality into Guzzle Bundle, a bundle for building RESTful web service clients.

Requirements
------------

[](#requirements)

- PHP 7.0 or above
- [Guzzle Bundle](https://github.com/8p/EightPointsGuzzleBundle)

### Installation

[](#installation)

Using [composer](https://getcomposer.org/):

##### composer.json

[](#composerjson)

```
{
    "require": {
        "gregurco/guzzle-bundle-wsse-plugin": "dev-master"
    }
}
```

##### command line

[](#command-line)

```
$ composer require gregurco/guzzle-bundle-wsse-plugin
```

Usage
-----

[](#usage)

### Enable bundle

[](#enable-bundle)

#### Symfony 2.x and 3.x

[](#symfony-2x-and-3x)

Plugin will be activated/connected through bundle constructor in `app/AppKernel.php`, like this:

```
new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle([
    new Gregurco\Bundle\GuzzleBundleWssePlugin\GuzzleBundleWssePlugin(),
])
```

#### Symfony 4

[](#symfony-4)

The registration of bundles was changed in Symfony 4 and now you have to change `src/Kernel.php` to achieve the same functionality.
Find next lines:

```
foreach ($contents as $class => $envs) {
    if (isset($envs['all']) || isset($envs[$this->environment])) {
        yield new $class();
    }
}
```

and replace them by:

```
foreach ($contents as $class => $envs) {
    if (isset($envs['all']) || isset($envs[$this->environment])) {
        if ($class === \EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle::class) {
            yield new $class([
                new \Gregurco\Bundle\GuzzleBundleWssePlugin\GuzzleBundleWssePlugin(),
            ]);
        } else {
            yield new $class();
        }
    }
}
```

### Basic configuration

[](#basic-configuration)

```
# app/config/config.yml

eight_points_guzzle:
    clients:
        api_payment:
            base_url: "http://api.domain.tld"

            # define headers, options

            # plugin settings
            plugin:
                wsse:
                    username:   "acme"
                    password:   "pa55w0rd"
                    created_at: "-10 seconds" # optional
```

Usage with guzzle
-----------------

[](#usage-with-guzzle)

```
