mobomo / guzzle-azure-hmac-auth
Azure HMAC Authentication
Installs: 7 693
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 22
Forks: 0
Open Issues: 0
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: >=6.5.x-dev
- guzzlehttp/psr7: >=1.9.x-dev
This package is not auto-updated.
Last update: 2024-06-05 21:50:51 UTC
README
use GuzzleHttp\Client; use GuzzleHttp\HandlerStack; use GuzzleHttp\Psr7\Request; use Mobomo\AzureHmacAuth\AzureHMACMiddleware; $azureHMACMiddleware = new AzureHMACMiddleware('<secret key>'); $handlerStack = HandlerStack::create(); $handlerStack->push($azureHMACMiddleware, 'hmac-auth'); $resourceEndpoint = "https://<hostname>.communication.azure.com"; $requestPath = "/emails:send?api-version=2023-03-31"; $requestUri = "{$resourceEndpoint}{$requestPath}"; $serializedBody = "<json>"; $client = new Client([ 'handler' => $handlerStack, ]); $requestMessage = new Request( 'POST', $requestUri, array( 'Content-Type' => 'application/json', ), $serializedBody ); $response = $client->send($requestMessage);