lucky-loek/really-simple-http-requests

This package is abandoned and no longer maintained. No replacement package was suggested.

A package for people who want to easily send requests and expect a status code and body back.

1.1.0 2019-07-29 07:55 UTC

This package is auto-updated.

Last update: 2021-05-09 14:38:41 UTC


README

Build Status

A framework-agnostic wrapper for really easy HTTP requests in PHP.

This is a package for people who want to easily send requests and expect a status code and body back. Nothing more, nothing less.

Installation

$ composer require lucky-loek/really-simple-http-requests

Or add to your composer.json file:

"require": {
    "lucky-loek/really-simple-http-requests": "^1.0"
}

Usage

$request = new Request(
    'www.httpbin.org/post',
    'post',
    'This is a nice body!',
    [
        'X-Csrf-Token' => 'notSoSafeToken'
    ]
);

$response = $request->send();

echo $response->getBody();
echo $response->getStatusCode();

// You can secretly take a look at the headers too!
echo $response->getHeader('Content-Length');

// Get them all!
foreach $response->getAllHeaders() as $header {
    echo $header;
}