============================================================================= Iniphile/PHP ============================================================================= ----------------------------------------------------------------------------- PHP binding for the Iniphile library ----------------------------------------------------------------------------- :Author: Roman Neuhauser :Contact: neuhauser@sigpipe.cz :Copyright: This document is in the public domain. .. contents:: Introduction ============ Iniphile/PHP is a PHP_ binding for the Iniphile_ library. Compatibility ============= Iniphile/PHP has been used, and is expected to work in the following environments: :PHP: 5.3, 5.4 :OS: FreeBSD 9, Windows XP, Vista, 7, 2003 Server, 2008 Server R2 :Compiler: GCC 4.2, 4.3, 4.4, 4.5, VS 2008 Express PHP versions prior to 5.3 are not supported. .. _PHP: http://www.php.net/ .. _Iniphile: http://codex.sigpipe.cz/iniphile/ Prerequisities ============== * PHP 5.3 or 5.4 * C++ compiler (gcc-4.2 or higher; MSVC 9) Reference ========= INI file syntax +++++++++++++++ See the `INI file syntax`_ section in the Iniphile documentation. .. _INI file syntax: http://codex.sigpipe.cz/iniphile/#ini-file-syntax class iniphile ++++++++++++++ :: class iniphile { static iniphile from_string(string $syntax); static iniphile from_file(string $path); __construct(string $path); array get(string $query, array $default); bool get(string $query, bool $default); float get(string $query, float $default); int get(string $query, int $default); string get(string $query, string $default); } iniphile::from_string ~~~~~~~~~~~~~~~~~~~~~ ``iniphile::from_string`` takes a single argument, a string ``$syntax`` conforming to the `INI file syntax`_. Returns an ``iniphile`` instance. Throws ``iniphile_error`` if parsing failed. iniphile::from_file ~~~~~~~~~~~~~~~~~~~ ``iniphile::from_file`` takes a single argument, a file ``$path``. Returns an ``iniphile`` instance. Throws ``iniphile_error`` if ``$path`` doesn't exist or parsing failed. iniphile::__construct ~~~~~~~~~~~~~~~~~~~~~ ``iniphile::__construct`` takes a single argument, a file ``$path``. Upon successful completion, ``$path`` has been parsed. Throws ``iniphile_error`` if ``$path`` doesn't exist or parsing failed. iniphile::get ~~~~~~~~~~~~~ ``iniphile::get`` takes two arguments, string ``$query``, and ``$default`` which may be ``array``, ``bool``, ``float``, ``int``, or ``string`` (or an object with a ``public string __toString()`` method). ``iniphile::get`` returns a value of the same type as the second argument. Throws ``iniphile_error`` if called with a wrong number of arguments or if the second argument isn't of one of the allowed types. See the Iniphile documentation for a complete description of `iniphile::get`_. .. _iniphile::get: http://codex.sigpipe.cz/iniphile/#t-get-t-ast-node-std-string-t Downloads ========= Repository ++++++++++ The latest source can be checked out from the Mercurial_ repository_. .. _Mercurial: http://selenic.com/mercurial/ .. _repository: https://hg.sigpipe.cz/ Official tarballs +++++++++++++++++ All Iniphile/PHP releases can be found in the `download directory`_. .. _download directory: http://codex.sigpipe.cz/php-iniphile/dist/ .. target-notes:: .. section-numbering:: .. vim: ft=rst sts=2 sw=2 tw=77