Download the PHP package neon-php/simple-http without Composer

On this page you can find all versions of the php package neon-php/simple-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 simple-http

simple-http

Installation

Introduction

simple-http provides a small interface to create really simple http-requests using the Guzzle-HTTP-Client.

Usage

Making Requests

The easiest way to make a new request is by using the static facade class Neon\Http\Facade\Http. This class provides static methods to create a new request instance of the class Neon\Http\Http.

In the simplest way you can make a request by calling a method for the corresponding http verb:

The following methods and their corresponding http verbs are supported:

Setting base url

By using the method setBaseURL you can set a base url that will be used for all following requests:

Framework request methods

Some frameworks may need a special request parameter to be sent to determine the request method. For example, sometimes a put-request is basically a post-request which contains to following request parameter.

To shorten this process the use of framework methods the corresponding functionality can be activated by using the method setFrameworkMethod:

Request inputs

To add input value to your request (post, put, patch, delete) you can call the addParam method to provide key/value pairs before calling the request method:

Alternatively you can add an array as the second parameter of the request method to provide multiple key/value pairs:

To provide query parameters for GET requests, you need to provide the query-key to the input array:

Adding request headers

To add additional request headers you can call the addHeader method before calling the request method:

To quickly add a bearer token to the authorization header you can use the bearer method:

Adding files

Files can be added via the file method. Just provide a key, the file name and the file location:

Response Handling

After making a request, the corresponding method will return an instance of Neon\Http\Response. This object provides several methods to work with the response.

Headers

The method hasHeader checks if a provided header key exists in the response:

The method getHeader returns the header values of the given header key. The values are returned as an array of strings:

Status Code

The method code returns the http status code of the response:

Additionally, there are several methods to check for specific pre-defined status codes:

Response body

The method body returns the response body as a string:

The method bodyRaw returns the response body as an instance of Psr\Http\Message\StreamInterface:

The method json converts the body string to a php array and returns it. The method throws an Neon\Http\Exceptions\RequestException if the body is not a valid json string.

Error Handling

The request methods get, post, put, patch and delete each throw an Neon\Http\Exceptions\RequestException if the request was, for whatever reason, unsuccessfull.


All versions of simple-http with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
guzzlehttp/guzzle Version 7.3
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 neon-php/simple-http contains the following files

Loading the files please wait ....