PHPackages                             laraveljutsu/bazooka - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. laraveljutsu/bazooka

ActiveLibrary[Testing &amp; Quality](/categories/testing)

laraveljutsu/bazooka
====================

Bazooka is a Laravel package that allows developers to simulate controlled failures (like API timeouts) inside their application for resilience testing.

v1.0.15(1y ago)281941[1 PRs](https://github.com/ludoguenet/laravel-bazooka/pulls)MITPHPPHP &gt;=8.2

Since Feb 16Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ludoguenet/laravel-bazooka)[ Packagist](https://packagist.org/packages/laraveljutsu/bazooka)[ RSS](/packages/laraveljutsu-bazooka/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (17)Used By (0)

[![Logo Laravel Bazooka](/art/logo-ghost.png)](/art/logo-ghost.png)

 [![Total Downloads](https://camo.githubusercontent.com/b333397558d62d36a33c37634c5eab934dacd9bb9fc657dad9658bcf01633656/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c6a757473752f62617a6f6f6b61)](https://packagist.org/packages/laraveljutsu/bazooka) [![Latest Stable Version](https://camo.githubusercontent.com/fb8dfc7eeb14ad57f7e98e9971f0287c972614d5e2b92a476e4f290cfa6570d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c6a757473752f62617a6f6f6b61)](https://packagist.org/packages/laraveljutsu/bazooka) [![License](https://camo.githubusercontent.com/6a11e44191bddff6ffb34989e2f0f8df0f96920655474d1b8c7eee07b753b681/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c61726176656c6a757473752f62617a6f6f6b61)](https://packagist.org/packages/laraveljutsu/bazooka)

Introduction
------------

[](#introduction)

**Inject chaos into your Laravel application with ease!**

Laravel Bazooka is a powerful Laravel package that allows you to inject controlled chaos into your application. Whether you're testing resilience, simulating failures, or just having fun, Bazooka provides a simple and configurable way to disrupt your application's behavior.

---

Features
--------

[](#features)

- **Inject Chaos Points**: Add `Bazooka::chaos()` calls to your controller methods with a configurable probability.
- **Disruption Strategies**: Choose from built-in strategies like latency delays or exception throwing.
- **Command-Line Tools**:
    - Inject chaos points into controllers.
    - List all chaos points in your application.
    - Remove chaos points from your codebase.
- **Dry Run Mode**: Safely test the removal of chaos points without modifying files.
- **Configurable Probability**: Control the likelihood of chaos being injected or triggered.

---

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require laraveljutsu/bazooka

```

Laravel will automatically register the service provider.

If needed, add to config/app.php providers array:

```
'providers' => [
    // ...
    LaravelJutsu\Bazooka\BazookaServiceProvider::class,
],

```

---

Configuration
-------------

[](#configuration)

After publishing the configuration file, you can customize the behavior of Bazooka by editing `config/bazooka.php`:

To publish the configuration file, run the following command:

```
php artisan vendor:publish --provider="LaravelJutsu\Bazooka\BazookaServiceProvider" --tag="config"

```

```
return [
    'enabled' => env('BAZOOKA_ENABLED', true), // Enable or disable Bazooka globally
    'probability' => 0.2, // Probability of chaos being injected or triggered (0 to 1)
    'strategies' => [
        'latency' => [
            'min_delay' => 100, // Minimum delay in milliseconds
            'max_delay' => 500, // Maximum delay in milliseconds
        ],
        'exception' => [
            'exceptions' => [
                \RuntimeException::class => 'Something went wrong!', // Exception class and message
            ],
        ],
    ],
];

```

---

Usage
-----

[](#usage)

### Inject Chaos Points

[](#inject-chaos-points)

Inject chaos points into your controller methods:

```
php artisan bazooka:inject

```

You can target specific controllers:

```
php artisan bazooka:inject --controller=TestController

```

### List Chaos Points

[](#list-chaos-points)

List all chaos points in your application:

```
php artisan bazooka:list

```

Example output:

```
+-----------------------------------+------+--------+
| File                              | Line | Method |
+-----------------------------------+------+--------+
| Http/Controllers/TestController.php | 10   | index  |
+-----------------------------------+------+--------+

```

### Remove Chaos Points

[](#remove-chaos-points)

Remove all chaos points from your codebase:

```
php artisan bazooka:remove

```

Use the `--dry-run` option to preview changes without modifying files:

```
php artisan bazooka:remove --dry-run

```

---

Disruption Strategies
---------------------

[](#disruption-strategies)

Bazooka comes with built-in disruption strategies. You can configure them in `config/bazooka.php`.

### Latency Disruption

[](#latency-disruption)

Add a delay to your application.

### Exception Disruption

[](#exception-disruption)

Throw a prepared exception.

---

Example
-------

[](#example)

### Controller Before Injection

[](#controller-before-injection)

```
namespace App\Http\Controllers;

class TestController
{
    public function index()
    {
        return 'Hello World';
    }
}

```

### Controller After Injection

[](#controller-after-injection)

```
namespace App\Http\Controllers;

class TestController
{
    public function index()
    {
        \LaravelJutsu\Bazooka\Facades\Bazooka::chaos(); // Chaos point injected here
        return 'Hello World';
    }
}

```

---

Testing
-------

[](#testing)

Run the test suite to ensure everything works as expected:

```
composer test

```

---

Contributing
------------

[](#contributing)

Contributions are welcome! Please open an issue or submit a pull request.

---

License
-------

[](#license)

This package is open-source software licensed under the [MIT License](LICENSE).

---

Credits
-------

[](#credits)

- Developed by [ludo 🐆](https://twitter.com/LaravelJutsu)
- Inspired by the need for chaos engineering in Laravel applications.

---

Enjoy injecting chaos into your Laravel applications with **Laravel Bazooka**! 🎉

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance44

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

16

Last Release

447d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3f1ac1a4b7fdf5d9283574fc60d79c986b1f2baf67b248a65f988a681dd470a6?d=identicon)[ludoguenet](/maintainers/ludoguenet)

---

Top Contributors

[![ludoguenet](https://avatars.githubusercontent.com/u/36139526?v=4)](https://github.com/ludoguenet "ludoguenet (40 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/laraveljutsu-bazooka/health.svg)

```
[![Health](https://phpackages.com/badges/laraveljutsu-bazooka/health.svg)](https://phpackages.com/packages/laraveljutsu-bazooka)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M571](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
