PHP code example of laraveljutsu / bazooka

1. Go to this page and download the library: Download laraveljutsu/bazooka library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laraveljutsu / bazooka example snippets


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

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
            ],
        ],
    ],
];

namespace App\Http\Controllers;

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

namespace App\Http\Controllers;

class TestController
{
    public function index()
    {
        \LaravelJutsu\Bazooka\Facades\Bazooka::chaos(); // Chaos point injected here
        return 'Hello World';
    }
}
bash
php artisan vendor:publish --provider="LaravelJutsu\Bazooka\BazookaServiceProvider" --tag="config"
bash
php artisan bazooka:inject
bash
php artisan bazooka:inject --controller=TestController
bash
php artisan bazooka:list
bash
php artisan bazooka:remove