PHP code example of aedart / athenaeum-http-clients
1. Go to this page and download the library: Download aedart/athenaeum-http-clients 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/ */
use Aedart\Http\Clients\Traits\HttpClientsManagerTrait;
use Aedart\Contracts\Http\Clients\Responses\Status;
use Teapot\StatusCode;
use DateTime;
class CurrencyController
{
use HttpClientsManagerTrait;
public function index()
{
$client = $this->getHttpClientsManager()->profile('my-client');
// Perform a GET request
$response = $client
->useTokenAuth('my-secret-api-token')
->where('currency', 'DKK')
->whereDate('date', new DateTime('now'))
->expect(StatusCode::OK, function(Status $status){
throw new RuntimeException('API is not available: ' . $status);
})
->get('/currencies');
// ...remaining not shown
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.