chaos-php / chaos-monkey
Chaos Monkey is a resiliency tool that helps PHP applications tolerate random failures
Installs: 2 907
Dependents: 1
Suggesters: 0
Security: 0
Stars: 28
Watchers: 3
Forks: 2
Open Issues: 0
pkg:composer/chaos-php/chaos-monkey
Requires
- php: ^8.1
 - akondas/php-runtime: ^1.1
 
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.27
 - phpstan/phpstan: ^1.11
 - phpunit/phpunit: ^9.5
 - symfony/browser-kit: ^5.2
 - symfony/framework-bundle: ^5.2
 - symfony/stopwatch: ^5.2
 
This package is auto-updated.
Last update: 2025-10-28 08:45:29 UTC
README
Chaos Monkey for PHP applications. Try to attack your running PHP App.
Assaults
- Latency Assault - adds a delay randomly from the range (min and max)
 - Exception Assault - throws given exception class
 - Memory Assault - fill memory until target fraction (95% for example)
 - Kill Assault - no mercy, plain 
exit() 
How to use
The best experience you can get is using ready-made integrations:
- Symfony: ChaosMonkeySymfonyBundle
 - Laravel: ChaosMonkeyLaravelPackage (in progress)
 
If your framework is missing, open an issue or use this package manually:
- Install with composer:
composer require chaos-php/chaos-monkey
 - Create 
ChaosMonkeyobject$settings = new Settings(); $chaosMonkey = new ChaosMonkey([ new LatencyAssault($settings), new MemoryAssault($settings), new ExceptionAssault($settings), new KillAppAssault($settings) ], $settings);
 - Configure settings and trigger chaos monkey in the working place of the application:
$settings->setExceptionActive(true); $settings->setExceptionClass(\RuntimeException::class); $settings->setProbability(100); $settings->setEnabled(true); $chaosMonkey->call();
 - Watch your app plunge into chaos 🙈🙊🙉 😈
 
License
ChaosMonkey is released under the MIT Licence. See the bundled LICENSE file for details.