Download the PHP package flix-tech/guzzle-circuit-breaker-middleware without Composer

On this page you can find all versions of the php package flix-tech/guzzle-circuit-breaker-middleware. 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 guzzle-circuit-breaker-middleware

Guzzle 6 Circuit-Breaker Middleware

Build Status

This is a Guzzle 6 middleware that integrates https://github.com/ejsmont-artur/php-circuit-breaker.

Contents

Requirements

Dependencies

Dependency Version Reason
php ~7.0 Anything lower has (almost) reached EOL
guzzlephp/promises ~6.2 Middlewares pass Promises around
psr/http-message ~1.0 Standardization, doh
ejsmont-artur/php-circuit-breaker ~0.1 Simple and robust Circuit Breaker implementation for PHP

Installation

This library is installed via composer.

Usage

NOTE It is recommended that this middleware is on top of the stack so that if a service is unavailable, it can instantly reject without going further down the chain.

With the default configuration, this middleware will inspect the PSR-7 requests for either a transport option key "circuit_breaker.requested_service_name" exposed via Middleware::CB_TRANSFER_OPTION_KEY in the request options array, or a request header "X-CB-Service-Name" exposed via Middleware::CB_SERVICE_NAME_HEADER. You can pass an own service name extractor callable that takes the form f(RequestInterface $request, array $requestOptions): string.

The service name will be used to look up the availability in the circuit breaker. If it is not available, it will be instantly rejected with a CircuitBreakerIsClosedException.

If the request was successful, the middleware will report a success to the circuit breaker for the given service. Otherwise it will report a failure and pass the rejection further down the chain.

You can pass a custom exception map into the middleware with which you can control which exception types and values should actually trigger a failure report. I.e. a 404 might be a failed configuration issue and might not trigger failure reports. The exception map callback takes the form f($rejectedValue): bool.

Example

Testing

To run the tests, just run ./vendor/bin/phpunit from the root of the project after installing the dev requirements.

Contributing

In order to contribute to this library, follow this workflow:


All versions of guzzle-circuit-breaker-middleware with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/promises Version ~1.2
psr/http-message Version ~1.0
ejsmont-artur/php-circuit-breaker Version ~0.1
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 flix-tech/guzzle-circuit-breaker-middleware contains the following files

Loading the files please wait ....