| Author: | Roman Neuhauser |
|---|---|
| Contact: | neuhauser@sigpipe.cz |
| Copyright: | This document is in the public domain. |
Contents
Iniphile/PHP is a PHP [1] binding for the Iniphile [2] library.
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.
See the INI file syntax [3] section in the Iniphile documentation.
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 takes a single argument, a string $syntax conforming to the INI file syntax [3]. Returns an iniphile instance. Throws iniphile_error if parsing failed.
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 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 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<T> [4].
The latest source can be checked out from the Mercurial [5] repository [6].
All Iniphile/PHP releases can be found in the download directory [7].
| [1] | http://www.php.net/ |
| [2] | http://codex.sigpipe.cz/iniphile/ |
| [3] | (1, 2) http://codex.sigpipe.cz/iniphile/#ini-file-syntax |
| [4] | http://codex.sigpipe.cz/iniphile/#t-get-t-ast-node-std-string-t |
| [5] | http://selenic.com/mercurial/ |
| [6] | https://hg.sigpipe.cz/ |
| [7] | http://codex.sigpipe.cz/php-iniphile/dist/ |