winnipass / php-request
Request Man is a PHP HTTP client library
dev-master
2016-11-29 01:56 UTC
Requires
- guzzlehttp/guzzle: ^6.2
- illuminate/support: ^5.3
- nategood/httpful: 0.2.20
Requires (Dev)
- phpunit/phpunit: 4.0.*
This package is not auto-updated.
Last update: 2025-03-29 22:17:19 UTC
README
A php http request library
composer autoloading
require_once DIR . "/vendor/autoload.php";
import RequestMan class
use RequestMan\RequestMan;
making a request
$url = "https://jsonplaceholder.typicode.com/posts";
$response = RequestMan::setUrl( $url )->setClient('guzzle')->send();
get raw data
var_dump($response->toRaw());
convert response to a laravel collection
var_dump($response->toCollection()); visit https://laravel.com/docs/5.3/collections for more details
convert response to array
var_dump($response->toCollection()->toArray());
get status code
echo RequestMan::getStatusCode();
get content type
echo RequestMan::getContentType();
supported clients
curl, guzzle, nategood