Read/write PHP settings (php.ini) at runtime.
Usually you configure PHP through php.ini file, however for some values, it's also possible to change these
settings at runtime.
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-8Use IniToolbox::set to set values:
use \Jawira\IniToolbox\{IniToolbox, Keys};
$ini = new IniToolbox();
$oldTimezone = $ini->set(Keys::DATE_TIMEZONE, 'Europe/Brussels');
echo $oldTimezone; // Europe/BerlinKeys 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'composer require jawira/ini-toolbox
If you liked this project, ⭐ star it on GitHub.
This library is licensed under the MIT license.