1. Go to this page and download the library: Download kshabazz/slib 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/ */
kshabazz / slib example snippets
use \Kshabazz\Slib\HttpClient;
// Initialize a new HTTP client object.
$httpClient = new HttpClient();
$url = 'http://www.example.com';
// Set headers
// Please note that the same header can be set multiple times, just like in the HTTP RFC.
$httpClient->setHeaders([
'Content-Type: application/json; charset=utf-8',
'Custom-Header: custom value',
]);
// Make a request and check the response.
$httpClient->send( $url );
$responseCode = $http->responseCode();
if ( $responseCode === 200 ) {
echo $httpClient->responseBody();
} else { // DEBUG
// Show what was sent in the last request.
var_dump( $httpClient->lastRequest() );
// Show the response headers.
var_dump( $httpClient->responseHeaders() );
}