PHP code example of phppkg / ini

1. Go to this page and download the library: Download phppkg/ini library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

phppkg / ini example snippets


use PhpPkg\Ini\Ini;
use Toolkit\Stdlib\Std\Collection;

$data = Ini::decode($ini);
vdump($data);

$cfg = Collection::new($data);
$int = $cfg->get('int'); // 23

$data = Ini::decodeFile($iniFile);

$data = [
    'key0' => 'val0',
    'key1' => 'val1',
    'key2' => 'val2',
    'key3' => 'val3',
    'key4' => 'val4',
    'arrKey' => [
        'abc',
        'def',
    ],
];

$iniString = Ini::encode($data);
echo $iniString;