Remote
A handy little class to handle all kinds of remote requests
How to get a $remote object
<?php
$response = new Remote('https://example.com');
echo $response->code(); // e.g. 200
echo $response->url(); // https://example.com
echo $response->method(); // GET
dump($response->content());
Note that instantiating the object will fetch the data.
You can also get an object by calling the Remote::request()echo method or one of the shortcuts;
Shortcuts
Instead of using Remote::request() with the request method defined in the $params array, you can use the HTTP method names as method:
Remote::get(), see$remote::get()Remote::post()Remote::delete()Remote::patch()Remote::put()Remote::head()
This works, because the Remote class implements the __callStatic magic method, which makes sure to execute not explicitely defined static methods.