1. Go to this page and download the library: Download api-clients/psr7-oauth1 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/ */
api-clients / psr7-oauth1 example snippets
use ApiClients\Tools\Psr7\Oauth1\Definition;
use ApiClients\Tools\Psr7\Oauth1\RequestSigning\RequestSigner;
// Pass it a PSR-7 request and it returns a signed PSR7 request you can use in any PSR7 capable HTTP client.
// By default a HMAC-SHA1 signature will be used, this can be changed, see examples below how to do that.
$request = (new RequestSigner(
new Definition\ConsumerKey('consumer_key'),
new Definition\ConsumerSecret('consumer_secret')
))->withAccessToken(
new Definition\AccessToken('token_key'),
new Definition\TokenSecret('token_secret')
)->sign($request);
use ApiClients\Tools\Psr7\Oauth1\Definition;
use ApiClients\Tools\Psr7\Oauth1\RequestSigning\RequestSigner;
use ApiClients\Tools\Psr7\Oauth1\Signature\HmacMd5Signature;
$consumerSecret = new Definition\ConsumerSecret('consumer_secret');
$requestSigner = new RequestSigner(
new Definition\ConsumerKey('consumer_key'),
$consumerSecret,
new HmacMd5Signature($consumerSecret)
);
use ApiClients\Tools\Psr7\Oauth1\Definition;
use ApiClients\Tools\Psr7\Oauth1\RequestSigning\RequestSigner;
use ApiClients\Tools\Psr7\Oauth1\Signature\HmacSha1Signature;
$consumerSecret = new Definition\ConsumerSecret('consumer_secret');
$requestSigner = new RequestSigner(
new Definition\ConsumerKey('consumer_key'),
$consumerSecret,
new HmacSha1Signature($consumerSecret)
);
use ApiClients\Tools\Psr7\Oauth1\Definition;
use ApiClients\Tools\Psr7\Oauth1\RequestSigning\RequestSigner;
use ApiClients\Tools\Psr7\Oauth1\Signature\HmacSha256Signature;
$consumerSecret = new Definition\ConsumerSecret('consumer_secret');
$requestSigner = new RequestSigner(
new Definition\ConsumerKey('consumer_key'),
$consumerSecret,
new HmacSha256Signature($consumerSecret)
);
use ApiClients\Tools\Psr7\Oauth1\Definition;
use ApiClients\Tools\Psr7\Oauth1\RequestSigning\RequestSigner;
use ApiClients\Tools\Psr7\Oauth1\Signature\HmacSha384Signature;
$consumerSecret = new Definition\ConsumerSecret('consumer_secret');
$requestSigner = new RequestSigner(
new Definition\ConsumerKey('consumer_key'),
$consumerSecret,
new HmacSha384Signature($consumerSecret)
);
use ApiClients\Tools\Psr7\Oauth1\Definition;
use ApiClients\Tools\Psr7\Oauth1\RequestSigning\RequestSigner;
use ApiClients\Tools\Psr7\Oauth1\Signature\HmacSha512Signature;
$consumerSecret = new Definition\ConsumerSecret('consumer_secret');
$requestSigner = new RequestSigner(
new Definition\ConsumerKey('consumer_key'),
$consumerSecret,
new HmacSha512Signature($consumerSecret)
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.