Skip to content

Releases: gabrielanhaia/php-circuit-breaker

v3.0.0

05 Feb 20:28
cf2451b

Choose a tag to compare

v3.0.0 — Complete Rewrite

A ground-up rewrite of the PHP Circuit Breaker library with multiple storage backends, an event system, and manual override capabilities.

Breaking Changes

  • Rename CircuitStateEnumCircuitState; backing value 'close''closed'
  • Replace CircuitBreakerAdapter abstract class with CircuitBreakerStorageInterface
  • Typed constructor: new CircuitBreaker($storage, $config, $dispatcher)
  • Remove Alert interface — use event listeners instead
  • Rename AdapterExceptionStorageException, CircuitExceptionOpenCircuitException
  • Move ext-redis from require to suggest
  • Remove KeyHelper class; Redis adapter uses INCR-based counting
  • Test namespace changed to GabrielAnhaia\PhpCircuitBreaker\Tests\

New Features

  • Immutable config: CircuitBreakerConfig value object with named arguments
  • Success threshold: configurable consecutive successes to close half-open circuits
  • Manual override: forceState() / clearOverride() with optional TTL
  • State inspection: getState() returns effective state (override > storage)
  • Event system: CircuitOpenedEvent, CircuitClosedEvent, CircuitHalfOpenEvent, FailureRecordedEvent, SuccessRecordedEvent
  • SimpleEventDispatcher: built-in lightweight dispatcher with parent-class listener support
  • PSR-14 bridge: Psr14EventDispatcherBridge wraps any PSR-14 dispatcher
  • 5 new storage adapters: InMemoryStorage, ApcuStorage, MemcachedStorage, Psr6CacheStorage, Psr16CacheStorage
  • Clock abstraction: TestClock for deterministic time-based testing

Quality

  • PHPStan at level max
  • PHP-CS-Fixer with PER-CS + PHP 8.1 migration rules
  • CI: 3 jobs (tests on PHP 8.1–8.4, static analysis, code style)

Deprecated

  • failed() → use recordFailure() (removed in v4)
  • succeed() → use recordSuccess() (removed in v4)

Migration Guide

See UPGRADE-3.0.md for a detailed migration guide from v2.

2.0.0

31 Aug 15:20

Choose a tag to compare

Changelog

2.0.0

  • Require PHP 8.1+
  • Replace eloquent/enumeration with native PHP enums
    • New GabrielAnhaia\\PhpCircuitBreaker\\CircuitStateEnum
    • CircuitBreakerAdapter::getState() returns CircuitStateEnum
  • Update tests for PHPUnit 10
  • Migrate CI to GitHub Actions
  • Redis operations use setEx for TTL handling
  • Documentation overhaul

1.x

  • PHP 7.4+/8.0+ support
  • CircuitState backed by eloquent/enumeration
  • Travis CI
  • Initial release and documentation

First Release

24 Jun 02:09
3b0b5ed

Choose a tag to compare

1.0.0

Update README.md

1.0.0-alpha

22 Jun 15:37

Choose a tag to compare

1.0.0-alpha Pre-release
Pre-release
feature: Add license badge