Download the PHP package mnapoli/bof without Composer

On this page you can find all versions of the php package mnapoli/bof. 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 bof

The HTTP client for humans.

Build Status Latest Version

Why?

Bof is a HTTP client meant to be as user friendly as possible.

It makes the most classic use cases, such as downloading a file, interacting with a JSON API or submitting a form, as simple as possible.

Since Bof is based on Guzzle, more advanced use cases can be addressed by using Guzzle's methods directly.

To sum up, Bof:

Future plans:

Want a short illustration? Here is Bof compared to Guzzle:

Do we need a new HTTP client?

Probably not. If this client attracts interest, that may mean that our already popular HTTP clients could use a simpler API targeting the simple use cases. If you maintain a HTTP client and are interested, I would love to merge Bof into existing libraries. Open an issue!

Installation

Usage

Configuration

The Bof\Http class is immutable.

Configuration is applied by calling withXxx() methods which create a new object every time:

Remember that withXxx() methods return a copy of the original client:

Thanks to that pattern, the same methods can be used to apply configuration only for a specific request:

Responses

Responses are PSR-7 compliant. They also provide methods to facilitate working with JSON responses:

The getData() method will decode the JSON response.

All PSR-7 methods are also available:

Learn more.

Sending JSON data

Using the JSON methods, the data will automatically encoded to JSON. A Content-Type header of application/json will be added.

Sending form data

Data can also be sent as a application/x-www-form-urlencoded POST request:

Exceptions

Invalid HTTP responses (status code 4xx or 5xx) will throw exceptions.

Learn more.

Headers

Timeouts

Timeouts are set at short values by default:

You can set shorter or longer timeouts (or disable them by setting them at 0):

Query string parameters

You can set query string parameters in the request's URI:

$response = $http->get('http://httpbin.org?foo=bar');

You can specify the query string parameters as an array:

Providing the option as an array will use PHP's http_build_query function to format the query string.

And finally, you can provide the query request option as a string.

Proxy

Use withSingleProxy() to specify a proxy for all protocols:

Use withMultipleProxies() to specify a different proxy for HTTP and HTTPS, as well as a list of host names that should not be proxied to:

Note that you can provide proxy URLs that contain a scheme, username, and password. For example, http://username:[email protected]:10.

Guzzle integration

Bof is based on Guzzle. You can even make it use your own Guzzle client, for example if you preconfigured it:

Learn more.


All versions of bof with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
ext-json Version *
guzzlehttp/guzzle Version ^6.4
guzzlehttp/psr7 Version ^1.6
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 mnapoli/bof contains the following files

Loading the files please wait ....