PHP code example of moux2003 / guzzle-bundle-sastoken-plugin

1. Go to this page and download the library: Download moux2003/guzzle-bundle-sastoken-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

moux2003 / guzzle-bundle-sastoken-plugin example snippets

 php
# app/AppKernel.php

new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle([
    new Moux2003\GuzzleBundleSasTokenPlugin\GuzzleBundleSasTokenPlugin(),
])
 php
 

$sasToken = new \Moux2003\GuzzleBundleSasTokenPlugin\Middleware\SasTokenAuthMiddleware($connectionString);

$stack = \GuzzleHttp\HandlerStack::create();

// Add the sasToken middleware to the handler stack.
$stack->push($sasToken->attach());

$client   = new \GuzzleHttp\Client(['handler' => $stack]);
$response = $client->post('https://namespace.windows.net/hubname/messages?api-version=2013-10');