Basic usage

require'vendor/autoload.php'useBuzz\Browser;useDevster\Buzz\Listener\WsseAuthListener;// Create a Buzz client$browser=newBrowser();// and add the Wsse listener$browser->addListener(newWsseAuthListener('username', '*******'));// finally use Buzz as usual$response=$browser->get('http://www.google.com');echo$browser->getLastRequest()."\n";echo$response;

Customization

All the plugin is configurable: the way to generate the nonce, the timestamp and also the password digest.

useBuzz\Browser;useBuzz\Message\RequestInterface;useDevster\Buzz\Listener\WsseAuthListener;$browser=newBuzz\Browser();$wsse=newWsseAuthListener('bob', '*********');$wsse// Customize the nonce generator// A callable that must return a string->setNonceCallback(function(RequestInterface$request) {returnuniqid('myapp_', true); })// Customize the timestamp generator// A callable that must return a string->setTimestampCallback(function(RequestInterface$request) {$date=new\DateTime("now");return$date->format('c'); })// Customize the digest generator// A callable that must return a string->setDigestCallback(function($nonce, $timestamp, $password, RequestInterface$request) {returnhash('sha512', $nonce.$timestamp.$password, true); });// add the listener to the browser$browser->addListener($wsse);