Guzzle plugin to manage WSSE authentication

Installs: 1 106

Dependents: 1

Stars: 8

Watchers: 3

Forks: 1

Language: PHP

2.1.0 2014-10-13 12:21 UTC


Latest Stable Version Build Status Scrutinizer Code Quality Code Coverage

Guzzle Plugin to manage WSSE Authentication

More informations on WSSE authentication

  • Guzzle 3: install 1.* version
  • Guzzle 4: install 2.* version


Install via composer

# Install Composer
curl -sS | php

# Add the plugin as a dependency
php composer.phar require devster/guzzle-wsse-plugin:~2.0

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

Basic usage

require 'vendor/autoload.php';

use GuzzleHttp\Client;
use Devster\GuzzleHttp\Subscriber\WsseAuth;

// Create a Guzzle client
$client new Client(['base_url' => '']);
// and add it the plugin
(new WsseAuth('username', 'pass****'))->attach($client);
// Or
$client->getEmitter()->attach(new WsseAuth('username', '********'));

// Now the plugin will add the correct WSSE headers to your guzzle request
$response = $client->get('/data')->send();


You can customize:

  • The nonce generation
  • The digest generation
  • And the date format
use GuzzleHttp\Client;
use GuzzleHttp\Message\RequestInterface;
use Devster\GuzzleHttp\Subscriber\WsseAuth;

$client = new Client;

$plugin = new WsseAuth('username', 'pass****');
    ->setNonce(function (RequestInterface $request) {
        return uniqid('my_nonce', true);
    ->setDigest(function ($nonce, $createdAt, $password) {
        return $nonce.$createdAt.$password;
    ->setDateFormat('Y-m-d') // PHP format. Default: c (ISO 8601)
    // Process a behavior (like hashing) on the password before it pass to the digest generator
    ->setPasswordProcessor(function ($password) {
        return sha1($password);


composer install && vendor/bin/phpunit


This plugin is licensed under the MIT License