Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
/ ini-toolbox Public archive

Read/write PHP settings (php.ini) at runtime

License

Notifications You must be signed in to change notification settings

jawira/ini-toolbox

Repository files navigation

Ini Toolbox

Read/write PHP settings (php.ini) at runtime.

Latest Stable Version Total Downloads License composer.lock Issues

Usage

Usually you configure PHP through php.ini file, however for some values, it's also possible to change these settings at runtime.

Get values

Use IniToolbox::get to get values:

use \Jawira\IniToolbox\{IniToolbox, Keys};

$ini = new IniToolbox();
$foo = $ini->get(Keys::SMTP_PORT);       // 25
$bar = $ini->get(Keys::DEFAULT_CHARSET); // UTF-8

Set values

Use IniToolbox::set to set values:

use \Jawira\IniToolbox\{IniToolbox, Keys};

$ini = new IniToolbox();
$oldTimezone = $ini->set(Keys::DATE_TIMEZONE, 'Europe/Brussels');
echo $oldTimezone; // Europe/Berlin

Constants

Keys is a convenience class, it contains most of the configuration options as constants.

use \Jawira\IniToolbox\Keys;

Keys::SMTP_PORT;            // same as 'smtp_port'
Keys::MAX_EXECUTION_TIME;   // same as 'max_execution_time'

How to install

composer require jawira/ini-toolbox

Contributing

If you liked this project, ⭐ star it on GitHub.

License

This library is licensed under the MIT license.

About

Read/write PHP settings (php.ini) at runtime

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published