Download the PHP package markenwerk/json-http-client without Composer

On this page you can find all versions of the php package markenwerk/json-http-client. 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 json-http-client

PHP JSON HTTP Client

Build Status SensioLabs Insight Code Climate Latest Stable Version Total Downloads License

A JSON HTTP client library. This project also is the reference implementation for extending the PHP Basic HTTP Client.

Installation

Usage

Autoloading and namesapce

Simple usage

Preparing the HTTP client

Performing requests and read the response

Body-less requests (GET, HEAD and DELETE)

Perfoming the following GET request with additional query parameters

will result in the following HTTP request.

The same mechanic is offered to perform HEAD and DELETE requests wich all are body-less.

Body-full requests (POST, PUT, PATCH)

Perfoming the following POST request with body data

will result in the following HTTP request.

The same mechanic is offered to perform PUT and PATCH requests wich all are body-full.


Detailed usage

The following example shows the usage with a more detailed configuration.

Configuring a HTTP Transport instance

Configuring a HTTPS Transport instance

Configuring a Message instance with Body

Message and request Header instances

Please note, that headers have some unusual behaviours. Header names have an uniform way of nomenclature so the following three getter calls would have the same result.

To allow multiple request headers using the same name, the method addAdditionalHeader provides such a logic.

Configuring an endpoints URL, build the Request instance and perform the HTTP request

For more information about the usage of the URL object please take a look at the PHP URL Util project.

The resulting HTTP request would be the following.

Usage of authentication methods

You can add one or more Authentication instances to every Request instance. At the moment this project provides classes for HTTP Basic Authentication and SSL Client Certificate Authentication.

HTTP Basic Authentication

Required credentials are a username and a password that get provided to the class constructor as arguments.

SSL Client Certificate Authentication

Required credentials are a Certificate Authority Certificate, a Client Certificate and the password that is used to decrypt the Client Certificate that get provided to the class constructor as arguments.


Reading from the resulting Response object

Getting the response object

If using the JsonHttpClient the response object is returned by the termination methods listed above. If directly using the JsonRequest instance, you can get the JsonResponse object via a getter.


Getting effective Request information

After successful performing the request, the effective request information is tracked back to the JsonRequest object. They can get accessed as follows.


Getting some transactional statistics


Exception handling

PHP JSON HTTP Client provides different exceptions – also provided by the PHP Common Exceptions project – for proper handling.
You can find more information about PHP Common Exceptions at Github.

Exceptions to be expected

In general you should expect that any setter method could thrown an \InvalidArgumentException. The following exceptions could get thrown while using PHP Basic HTTP Client.


Contribution

Contributing to our projects is always very appreciated.
But: please follow the contribution guidelines written down in the CONTRIBUTING.md document.

License

PHP JSON HTTP Client is under the MIT license.


All versions of json-http-client with dependencies

PHP Build Version
Package Version
No informations.
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 markenwerk/json-http-client contains the following files

Loading the files please wait ....