duncan3dc/php-ini

Manage php.ini settings on a temporary basis.

1.2.0 2021-01-10 19:53 UTC

This package is auto-updated.

Last update: 2024-04-11 03:10:05 UTC


README

Manage php.ini directives on a temporary basis.

Full documentation is available at https://duncan3dc.github.io/php-ini/
PHPDoc API documentation is also available at https://duncan3dc.github.io/php-ini/api/

release build coverage

Installation

The recommended method of installing this library is via Composer.

Run the following command from your project root:

$ composer require duncan3dc/php-ini

Getting Started

use duncan3dc\PhpIni\Ini;
use duncan3dc\PhpIni\Settings;

require __DIR__ . "/vendor/autoload.php";

$ini = new Ini;

$ini->set(Settings::INCLUDE_PATH, "/tmp/cool-php-stuff");

require "my-cool-file.php";

$ini->restore(Settings::INCLUDE_PATH);
use duncan3dc\PhpIni\Ini;
use duncan3dc\PhpIni\Settings;
use duncan3dc\PhpIni\State;

$ini = new State;

$ini->set(Settings::MEMORY_LIMIT, "1M");

$ini->call(function () {
    # This code can't use much memory
});

# This code can use as much memory as the default memory_limit allows
eatAllTheMemory();

Read more at http://duncan3dc.github.io/php-ini/

Changelog

A Changelog has been available since the beginning of time

Where to get help

Found a bug? Got a question? Just not sure how something works?
Please create an issue and I'll do my best to help out.
Alternatively you can catch me on Twitter

duncan3dc/php-ini for enterprise

Available as part of the Tidelift Subscription

The maintainers of duncan3dc/php-ini and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.