Download the PHP package rexlabs/hyper-http without Composer

On this page you can find all versions of the php package rexlabs/hyper-http. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hyper-http

Deprecated

This library isn't in active development.

Please consider guzzlehttp/guzzle or another library instead.

Bug fixes only.

Hyper Http Client

License: MIT Packagist

Overview

Hyper is an HTTP Client that aims to provide a simple, but powerful interface for making HTTP calls and fetching and manipulating API data.

Why use Hyper

Usage

Installation

To install in your project:

Examples

The RESTful methods all return a Response object which makes interacting with responses simple.

Example: Using static methods

Example: Working with a JSON API

Since responses mixin ArrayObject you can easily fetch and manipulate values from the response:

Example: Set global headers and pass in a logger

Use make() to simplify instantiation and then setup the object for future requests:

Example: Instantiation via constructor

To get complete control over instantiation, use the constructor and pass in a Guzzle instance:

Example: Dumping a cURL request

You can easily generate a cURL request for running from the command-line to reproduce your last request:

Output:

Http Methods

Hyper provides the following methods for interacting with remote endpoints:

get()

get(mixed $uri, array $query = [], array $headers = [], array $options = []): Response

Send an HTTP GET request, and return the Response:

post()

post(mixed $uri, mixed $body = null, array $headers = [], array $options = []): Response

Send an HTTP POST request, and return the Response:

Alternative methods:

put()

put(mixed $uri, mixed $body = null, array $headers = [], array $options = []): Response

Send an HTTP PUT request, and return the Response:

patch()

patch(mixed $uri, mixed $body = null, array $headers = [], array $options = []): Response

Send an HTTP PATCH request, and return the Response:

delete()

delete(mixed $uri, mixed $body = null, array $headers = [], array $options = []): Response

Send an HTTP DELETE request, and return the Response:

call()

call(string $method, mixed $uri, mixed $body, array $headers, array $options): Response

Send a generic HTTP request by specifying the method as the first argument.

Request Methods

Methods available from the Rexlabs\HyperHttp\Message\Request object:

getUri()

Return the UriInterface object which encapsulates the URI/URL for this request.

getMethod()

Return the HTTP method verb for this Request.

getHeaders()

Retur an array of headers for this Request

getCurl()

Return a cURL request (string) suitable for running from the command-line. Useful for debugging requests.

Response Methods

Methods available from the Rexlabs\HyperHttp\Message\Response object:

getRequest()

Return the Rexlabs\HyperHttp\Message\Request object associated with the Response

getCurlRequest()

Return a cURL request (string) suitable for running from the command-line. Useful for debugging requests.

getStatusCode()

Return the HTTP status code for this Response. EG. 200

getReasonPhrase()

Return the HTTP reason phrase associated with the status code. EG. "OK"

isJson()

Returns true if this is a JSON response.

toArray()

Converts a JSON response to an array and returns the array.

toObject()

Converts a JSON response to an ArrayObject

ArrayObject

Every Response object has all of the methods and functionality of the ArrayObject class from the rexlabs\array-object package.

This means based on the following response payload:

You can perform the following functions:

You can also call:

Config

Set default config for all client's (defaults to [])

Set config for this client (values will override / merge with default)

Default Logger

Set the default logger used by all clients that don't provide one.
Must implement LoggerInterface (defaults to NullLogger)

Log Curl

Log the curl string for all requests (requires a logger set)

Guzzle config

Set the config passed to the underlying GuzzleClient

Tests

To run tests:

To run coverage report:

Coverage report is output to ./tests/report/index.html

Extending

Hyper allows extension for custom clients by:

Contributing

Contributions are welcome, please submit a pull-request or create an issue. Your submitted code should be formatted using PSR-1/PSR-2 standards.

About


All versions of hyper-http with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4 <8.3
psr/log Version ^1.0 || ^2.0 || ^3.0
rexlabs/utility-belt Version ^4.0
guzzlehttp/guzzle Version ^7.0
guzzlehttp/psr7 Version ^2.4.0
rexlabs/array-object Version ^3.0
rtheunissen/guzzle-log-middleware Version ^1.0
rexlabs/cuzzle Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rexlabs/hyper-http contains the following files

Loading the files please wait ....