Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

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

License

Notifications You must be signed in to change notification settings

Lucky-Loek/Really-Simple-Http-Requests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Really Simple HTTP Requests

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;
}

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages