PHP code example of keven / timeout

1. Go to this page and download the library: Download keven/timeout 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/ */

    

keven / timeout example snippets




use Keven\Timeout\Invoker;

$timeout = new Invoker;

// Execute code in under 2s, or throws an exception
$timeout(function() { sleep(1); return 'ok'; }, 2);