wordproof / api-client
This package is abandoned and no longer maintained.
No replacement package was suggested.
WordProof API client
0.3.0
2021-03-22 12:37 UTC
Requires
- php: ^7.1.3|^8.0
- ext-curl: *
- ext-json: *
- nyholm/psr7: ^1.4
- php-http/httplug: ^2.2
- psr/http-client: ^1.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- spatie/ray: ^1.21
Suggests
- guzzlehttp/guzzle: Using implementation of ClientInterface for package
This package is auto-updated.
Last update: 2022-06-24 10:22:26 UTC
README
Requirements
- PHP 5.6.20 | ^7.0 | ^8.0
- cURL extension
- JSON extension
Install
composer require wordproof/api-client
Usage
use WordProof\ApiClient\WordProofApi;
$wordproof = new WordProofApi('SOMEAPIKEY');
$response = $wordproof->timestamp()->post([
'foo' => 'bar',
'another_foo' => 'another_bar',
]);
You can specify some options:
use WordProof\ApiClient\WordProofApi;
$wordproof = new WordProofApi('SOMEAPIKEY');
$response = $wordproof->withOptions([
'endpoint' => 'http://endpoint.com'
])
->timestamp()->post([
'foo' => 'bar',
'another_foo' => 'another_bar',
]);
You can use your own PSR Request and StreamFactory implementations:
use WordProof\ApiClient\WordProofApi;
use Laminas\Diactoros\Request;
use Laminas\Diactoros\StreamFactory;
$wordproof = new WordProofApi('SOMEAPIKEY');
$request = new Request(
'http://endpoint.com',
'POST',
(new StreamFactory())->createStream(json_encode([
'foo' => 'bar',
'another_foo' => 'another_bar',
])),
['Content-Type' => 'application/json']
);
$response = $wordproof->sendRequest($request);