Giter Site home page Giter Site logo

ini-toolbox's Introduction

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.

ini-toolbox's People

Contributors

jawira avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

ini-toolbox's Issues

badges

  • update huboard badge
  • add other badges

advanced usage

Create an "advanced usage" document to complement readme file.

  • Deprecated constants: Explain constants deprecation
  • Behaviour with non-existing keys: When key is invalid get/set returns 'null'
  • Describe other methods when available. Readme file should only explain get/set.

Also add a table of contents in readme file

Add pdo constants

    /**
     * pdo.dsn.*
     *
     * - Default:  
     * - Changeable:  only
     * - Changelog: Available since PHP 5.1.0.
     *
     * @see        https://www.php.net/manual/en/pdo.configuration.php#ini.pdo.dsn
     * @deprecated This configuration setting cannot be set at Runtime
     */
    const PDO_DSN_* = 'pdo.dsn.*';

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.