Releases: gabrielanhaia/php-circuit-breaker
Releases · gabrielanhaia/php-circuit-breaker
v3.0.0
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
CircuitStateEnum→CircuitState; backing value'close'→'closed' - Replace
CircuitBreakerAdapterabstract class withCircuitBreakerStorageInterface - Typed constructor:
new CircuitBreaker($storage, $config, $dispatcher) - Remove
Alertinterface — use event listeners instead - Rename
AdapterException→StorageException,CircuitException→OpenCircuitException - Move
ext-redisfromrequiretosuggest - Remove
KeyHelperclass; Redis adapter usesINCR-based counting - Test namespace changed to
GabrielAnhaia\PhpCircuitBreaker\Tests\
New Features
- Immutable config:
CircuitBreakerConfigvalue 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:
Psr14EventDispatcherBridgewraps any PSR-14 dispatcher - 5 new storage adapters:
InMemoryStorage,ApcuStorage,MemcachedStorage,Psr6CacheStorage,Psr16CacheStorage - Clock abstraction:
TestClockfor 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()→ userecordFailure()(removed in v4)succeed()→ userecordSuccess()(removed in v4)
Migration Guide
See UPGRADE-3.0.md for a detailed migration guide from v2.
2.0.0
Changelog
2.0.0
- Require PHP 8.1+
- Replace
eloquent/enumerationwith native PHP enums- New
GabrielAnhaia\\PhpCircuitBreaker\\CircuitStateEnum CircuitBreakerAdapter::getState()returnsCircuitStateEnum
- New
- Update tests for PHPUnit 10
- Migrate CI to GitHub Actions
- Redis operations use
setExfor TTL handling - Documentation overhaul
1.x
- PHP 7.4+/8.0+ support
CircuitStatebacked byeloquent/enumeration- Travis CI
- Initial release and documentation
First Release
1.0.0 Update README.md
1.0.0-alpha
feature: Add license badge