samlitowitz / php-memory
A library to interact with PHP memory limit
v1.0.2
2023-08-02 22:34 UTC
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-11-03 01:33:28 UTC
README
Table of Contents
Installation
composer require samlitowitz/php-memory
Usage
use PhpMemory\MemoryLimit; use PhpMemory\Unit\Binary\Megabyte; MemoryLimit::set(Size::create(2, new Megabyte()), true); echo init_get(MemoryLimit::INI_OPTION); // 1M
use PhpMemory\MemoryLimit; use PhpMemory\Unit\Byte; MemoryLimit::set(Size::create(100, new Byte())); echo init_get(MemoryLimit::INI_OPTION); // 100
See MemoryLimitTest for more examples.