krakjoe/ilimit

IDE and static analysis helper for the krakjoe/ilimit extension

Maintainers

👁 krakjoe

Package info

github.com/krakjoe/ilimit

Language:C

pkg:composer/krakjoe/ilimit

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 68

Open Issues: 1

dev-master 2019-11-30 07:35 UTC

Requires

  • php: >=7.1.0
  • ext-ilimit: *

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

PHP-3.01 02319dd104f85ed1927dbdf0844ad339887d372c

  • Joe Watkins <krakjoe.woop@php.net>

calltimeoutlimitilimit

This package is auto-updated.

Last update: 2026-06-29 01:42:44 UTC


README

ilimit provides a method to execute a call while imposing limits on the time and memory that the call may consume.

Requirements

  • PHP 7.1+
  • NTS
  • pthread.h

Stubs

This repository includes PHP files with method headers for IDE integration and static analysis support.

To install, run the following command:

composer require krakjoe/ilimit

API

namespace ilimit {
 /**
 * Call a callback while imposing limits on the time and memory that
 * the call may consume.
 *
 * @param callable $callable The invocation to make.
 * @param array $arguments The list of arguments.
 * @param int $timeout The maximum execution time, in microseconds.
 * @param int $maxMemory The maximum amount of memory, in bytes.
 * If set to zero, no limit is imposed.
 * @param int $checkInterval The interval between memory checks,
 * in microseconds. If set to zero or less,
 * a default interval of 100 microseconds is used.
 *
 * @return mixed Returns the return value of the callback.
 *
 * @throws Error\Runtime If timeout is not positive.
 * @throws Error\Runtime If maxMemory is negative.
 * @throws Error\System If the system lacks necessary resources to make the call.
 * @throws Error\Timeout If the invocation exceeds the allowed time.
 * @throws Error\Memory If the invocation exceeds the allowed memory.
 */
 function call(callable $callable, array $arguments, int $timeout, int $maxMemory = 0, int $checkInterval = 0);
}