PHP code example of kkedzierski / rest-api-client

1. Go to this page and download the library: Download kkedzierski/rest-api-client 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/ */

    

kkedzierski / rest-api-client example snippets


$response = $RAC->get('/user/repos');

$response = $RAC->get('/user/:id/repos', 123);



use RestApiClient\RestApiClient;

ithub.com");
$additonalParamArr = [
    "header" => 
        ["User-Agent: Test REST API Client", 
        "Authorization: token api_token"]
];
$response = $RAC->get('/user/repos', additionalField: $additonalParamArr);

// or
// $rac->addToHeader("User-Agent", "Test REST API Client");
// $rac->addToHeader("Authorization", "token api_token");
// $response = $RAC->get('/user/repos');

$response->getUrl();
$response->getStatusCode();
$response->getHeader();
$response->getHeaderLine("user-agent");
$response->getBody();
$response->getContent();