PHP code example of nddcoder / laravel-http-client
1. Go to this page and download the library: Download nddcoder/laravel-http-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/ */
nddcoder / laravel-http-client example snippets
use Nddcoder\HttpClient\HttpClient;
class TodoController extends Controller
{
private $http;
public function __construct(HttpClient $http)
{
$this->http = $http;
}
public function index()
{
return $this->http->get('https://jsonplaceholder.typicode.com/todos');
/*
{
"status_code": 200,
"headers": {},
"body": "...",
"bodyJSON": [...]
}
*/
}
}