PHP code example of nhatnathando / laravel-api-replay

1. Go to this page and download the library: Download nhatnathando/laravel-api-replay 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/ */

    

nhatnathando / laravel-api-replay example snippets


protected $middlewareGroups = [
    'api' => [
        \Storage\ApiReplay\Http\Middleware\RecordApiRequest::class,
        // Optional: Add this to enable automatic DB rollback during Dry Run replays
        \Storage\ApiReplay\Http\Middleware\SimulationMiddleware::class,
    ],
];

use Storage\ApiReplay\Support\ApiReplay;

if (ApiReplay::isDryRun()) {
    // Skip sending real SMS or calling external 3rd party APIs
    return;
}
bash
php artisan vendor:publish --tag="api-replay-config"
php artisan vendor:publish --tag="api-replay-migrations"
php artisan vendor:publish --tag="api-replay-views"
bash
php artisan migrate