PHP code example of jaydeep / laravel-time-machine

1. Go to this page and download the library: Download jaydeep/laravel-time-machine 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/ */

    

jaydeep / laravel-time-machine example snippets


use Jaydeep\LaravelTimeMachine\Facades\TimeMachine;

// Drop a marker on the timeline
TimeMachine::mark('cache primed');

// Time a block of code as a span
$report = TimeMachine::measure('generate-report', function () {
    return Report::build();
});

// Or open and close it manually
TimeMachine::startSpan('external-api');
$response = Http::get('https://api.example.com');
TimeMachine::endSpan('external-api');
bash
php artisan vendor:publish --tag=time-machine-config

http://your-app.test/time-machine?method=GET&url=/api/users/*&duration_operator=gte&duration=500