Download the PHP package omidrezasalari/circuit-breaker-bundle without Composer

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

Circuit Breaker Bundle

This package is a Symfony bundle that implements the Circuit Breaker pattern. It helps protect your services from repeated requests when failures occur. The package is designed to allow you to easily change the storage mechanism (e.g., Redis, APCu, or custom implementations).

Features


Installation

1. APCu Implementation (Optimized and Persistent in Memory)

APCu is an internal PHP cache that stores data in shared memory and can be accessed across different requests on a server.

1.1 Install and Enable APCu

Before using APCu as a storage mechanism for the Circuit Breaker bundle, ensure that APCu is installed and enabled on your server.

1.2 Check if APCu is installed:

`

If it's not installed, you can install it with the following commands:

1.3 Enable APCu for CLI (Command Line Interface):

Edit your php.ini file to enable APCu for the CLI: `

2. Install the package via Composer, run the following command:

`

After installing, register the bundle in your config/bundles.php:


Configuration

The circuit breaker bundle uses a configurable failure threshold and timeout period. You can configure these parameters in your config/services.yaml.

Package Configuration File (circuit_breaker.yaml):

This file is placed under the directory and allows users to define custom configurations for the package. The file looks like this

Configuration Details:

Storage Service:

By default, the storage_service is set to . If you prefer to use , simply change this value in : `

and parameters:

These values control how many failures are allowed before the circuit breaker trips and for how long it stays open.

Custom Storage

The bundle comes with a default ApcuStorage implementation. If you want to use a different storage solution, implement the StorageInterface and pass it to the CircuitBreaker service.


Usage

Here’s an example of how to use the CircuitBreaker service:


API

isOpen(string $serviceName): bool

Checks whether the circuit breaker for the given service is open. Returns true if open, false if not.

attemptSuccess(string $serviceName): void

Called when a service operation is successful. Resets the failure count and closes the circuit breaker.

attemptFailure(string $serviceName): void

Called when a service operation fails. Increments the failure count. If the failure threshold is reached, the circuit breaker will open.


Running Tests

To run the tests for the bundle, you can use PHPUnit:


Contributing

If you'd like to contribute to the development of this bundle, feel free to fork the repository, create a branch, and submit a pull request. Please ensure your code follows the coding standards and includes tests for any new features or bug fixes.


License

This bundle is open-source and available under the MIT License.



All versions of circuit-breaker-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
symfony/framework-bundle Version ^6.0 || ^7.0
predis/predis Version *
ext-apcu Version *
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 omidrezasalari/circuit-breaker-bundle contains the following files

Loading the files please wait ....