PHP code example of mayoturis / properties-ini

1. Go to this page and download the library: Download mayoturis/properties-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/ */

    

mayoturis / properties-ini example snippets


$config = Mayoturis\Properties\RepositoryFactory::make('path_to_configuration_file');
$config->get('DB_PASSWORD');
$config->set('DB_STRICT_MODE', true);

[
  "name"    => "John",
  "surname" => "Doe",
  "age"     => 25,
  "salary"  => 12.5
  "married" => false,
  "wife"    => null
]

$config = Mayoturis\Properties\RepositoryFactory::make('path_to_configuration_file');
$configurationArray = $config->all();

// file index.php

$config = Mayoturis\Properties\RepositoryFactory::make(__DIR__ . '/.env');
$config->set('name', 'Johny');
$config->set('age', 35);

$configArray = [
  "username" => "user",
  "password" => "password"
];

$config = Mayoturis\Properties\RepositoryFactory::make('path_to_configuration_file');
$config->setAll($configArray);

name="John"
surname=Doe
age=25
salary=12.5
married=false
wife=null