PHP code example of directions / http-wrapper
1. Go to this page and download the library: Download directions/http-wrapper 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/ */
directions / http-wrapper example snippets
class MyRequest extends Request
{
public function getPayload(): array
{
return [
'param_1' => 1,
'param_2' => 'value 2',
];
}
}
class MyRequest extends Request
{
public function parse_response(Response $response): mixed
{
if ($response->successful()) {
return $response->object();
}
return null;
}
}
MyRequest::getInstance()->get_response();