Download the PHP package gocanto/http-client without Composer

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

About it

Total Downloads Latest Stable Version Build status

This library is a wrapper around the famous Guzzle HTTP client with some goodies on top of it.

This client gives you the ability to perform retries and log any request information you may need.

Installation

This library uses Composer to manage its dependencies. So, before using it, make sure you have it installed in your machine. Once you have done this, you will be able to pull this library in by typing the following command in your terminal.

The reason behind

Sometimes you will need the ability to retry a HTTP request for some given reason. This can be either due to latency issues or some timeout errors.

To avoid this interruptions, we usually perform a retry action inside a given loop. Then, we either break the loop because we have a valid response to return with or because we need to handle possible errors.

Therefore, I have created this small wrapper to handle retries actions and to log our requests/responses payload within the same action.

How does it work?

The way how this client works is exactly the same as the one you have been used to it. You will be able to call any known guzzle method and attach the retry action to them.

Let's say you need to perform some HTTP request to fill seed your db with some data. To do so, you would have to write some code along these lines.

This is a simple use case that we all have came across some other time. But, What would you do if there is an error and you need to handle some retries?

Well, if you are anything like me, you would do something like:

There you have a working code, but you will have to do the same procedure every time you need to perform some kind of HTTP request.

We can do better!

By using the HTTP client shipped within this package, you will be able to call the retry mechanism within the same HTTP call. For Example:"

This line of code does exactly the same as the ones above, but more efficient and elegant. This library also ships a different method onRetry() that performs the same retries, but it also gives the ability to hook into the retry call.

You would be able to use it like so:

Here, you will be given the incoming request and response that you are handling in that particular moment. see more

On-Demand Headers

Sometimes, we need to add headers to a given client instance based on dynamic data.

Such as requirement is not possible on the creation stage because we do not know what information we would be dealing with. Therefore, we need a mechanism to hook into and populate this data when needed.

This client supports this functionality through the with Headers to allow on-demand headers values whenever needed.

For instance, you would be able to do something like so:

to populate as many headers as needed.

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance its functionality.

License

The MIT License (MIT). Please see License File for more information.

How can I thank you?

There are many ways you would be able to support my open source work. There is not a right one to choose, so the choice is yours.

Nevertheless :grinning:, I would propose the following

Thank you for reading this far. :blush:


All versions of http-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1|8.2
guzzlehttp/guzzle Version ^7.5
psr/http-message Version ^1.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 gocanto/http-client contains the following files

Loading the files please wait ....