Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phystrix Laravel Package

odesk/phystrix

Phystrix is a PHP implementation of Netflix Hystrix for fault tolerance and latency isolation. It wraps remote calls with circuit breakers, timeouts, fallbacks, and metrics to prevent cascading failures in distributed systems and Laravel apps.

Deep Wiki
Context7

Phystrix is a latency and fault tolerance library for PHP, inspired by Netflix’s Hystrix

Frequently asked questions about Phystrix
What is odesk/phystrix and how does it work?
Phystrix is a PHP implementation of the circuit breaker pattern inspired by Netflix Hystrix. You wrap each remote call in a command object, and Phystrix tracks failures and latency for that dependency. When error rates cross configured thresholds the circuit opens and later calls fail fast instead of waiting on a sick service. It also provides fallbacks, request caching, and metrics so your application can degrade gracefully.
How do I install odesk/phystrix in a Laravel application?
Install it with Composer by running composer require odesk/phystrix. The library is framework agnostic and does not ship an official Laravel service provider, so you normally register a Phystrix factory or configuration singleton inside one of your own service providers. Resolve that binding from the container and inject it into the services or jobs that make outbound calls.
Is odesk/phystrix compatible with Laravel 10, 11, or 12?
Phystrix has no Laravel-specific dependencies, so it works with any Laravel release whose PHP version satisfies the package's composer.json constraint. Because the library is old, check that constraint carefully before installing on PHP 8.1 or newer and run your test suite against it. If the requirement blocks you, pin an older runtime or wrap the same pattern in a small in-house implementation.
How do I configure circuit breaker thresholds and timeouts in Phystrix?
Configuration is supplied as an array when you build the Phystrix instance, covering circuit breaker settings such as error threshold percentage, request volume threshold, and sleep window, plus command settings like timeout and fallback. Settings can be defined per command class so different dependencies get different tolerances. Keep these values in config files so you can tune them per environment without touching code.
What does a Phystrix fallback do and when should I use one?
A fallback runs when a command throws, times out, or is short-circuited because the circuit is open. It lets you return cached data, a sensible default, or a graceful acknowledgement instead of surfacing an error to the user. Use fallbacks for non-critical enrichments such as recommendations or avatar lookups, and avoid them where the caller genuinely needs to know an operation failed.
How does Phystrix handle timeouts and concurrent commands?
Each command can declare a timeout, so a slow dependency fails fast rather than tying up your request cycle. Phystrix also supports running commands concurrently, which shortens total latency when you fan out to several services at once. Since PHP requests are single-threaded, isolation is cooperative rather than the thread-pool model used by the JVM version of Hystrix.
How do request caching and metrics work in Phystrix?
Request caching deduplicates identical command executions within a scope so one request does not hammer the same endpoint repeatedly. Metrics are collected per command and can be published through a metrics publisher, letting you push counters and latency data into your monitoring stack. In Laravel you would wire that publisher into your existing logging, Prometheus, or hosted metrics service.
How do I test code that uses Phystrix?
Inject the Phystrix factory or command objects through Laravel's container so tests can substitute fakes or stubs. Simulate failure paths by making the underlying HTTP client throw, then assert that the fallback runs and the circuit state changes as expected. Use an in-memory metrics collector in tests to verify thresholds without waiting for real cool-down windows.
Is odesk/phystrix still maintained, and what are the alternatives?
The package originates from oDesk, which later became Upwork, and it has not seen active development for years, so treat it as stable but dormant. If you need current PHP support, evaluate actively maintained circuit breaker libraries or build a small breaker around Laravel's HTTP client. Laravel's built-in retry and timeout options already cover many resilience needs on their own.
How is Phystrix different from Laravel's Http::retry() and timeout options?
Laravel's HTTP client retries individual requests and enforces timeouts, but it does not track dependency health across requests. A circuit breaker remembers recent failures and stops calling a failing service entirely for a cool-down window, protecting your workers and queues from piling up. Many teams combine both: circuit breaking at the command level and short retries for transient blips.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource