keven/timeout

Execute code within a time limit.

1.0.0 2019-08-16 22:17 UTC

This package is auto-updated.

Last update: 2024-06-06 04:19:55 UTC


README

Installation

$ composer require keven/timeout

Usage

<?php

use Keven\Timeout\Invoker;

$timeout = new Invoker;

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