PHP Classes
elePHPant
Icontem

PHP INI Read and Write Class: Read and write configuration values in INI files

Recommend this page to a friend!

  Author Author  
Name: Radovan Janjic is available for providing paid consulting. Contact Radovan Janjic .
Classes: 14 packages by
Country: Serbia Serbia
Age: 29
All time rank: 2932 in Serbia Serbia
Week rank: 50 Up1 in Serbia Serbia Up
Innovation award
Innovation award
Nominee: 3x


  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can read and write configuration values in INI files.

It can parse a given INI file and extract the contained configuration values into class array variables.

The class can also do the opposite, i.e., write the configuration values in the array variable back to a INI file.

Details

PHP_INI_Read_Write

This class can read and write configuration values in INI files.

It can parse a given INI file and extract the contained configuration values into class array variables.

The class can also do the opposite, i.e., write the configuration values in the array variable back to a INI file.

Examples:

// Parse config.ini
$ini = new INI('config.ini');

// Content of: config.ini
print_r($ini->data);

// Udate settings
$ini->data['first_section']['animal'] = 'COW';

// Save settings to file
$ini->write();

// Update settings
$ini->data['first_section']['animal'] = 'HORSE';

// Add new setting to section third_section
$ini->data['third_section']['phpversion'][] = 5.4;

// Add new section third_section and new item something
$ini->data['fourth_section']['something'] = 'some data';

// Save settings to new file
$ini->write('config-2.ini');

// INI obj is now using ini 2 file
// Content of: config-2.ini
print_r($ini->data);

// Parse config.ini
$ini->read('config.ini');

// Remove item from second_section
unset($ini->data['second_section']['URL']);

// Remove third_section from second ini file and save to third file
unset($ini->data['third_section']);

// Save settings to new file
$ini->write('config-3.ini');

// INI obj is now using ini 3 file
// Content of: config-3.ini
print_r($ini->data);

  Classes of Radovan Janjic  >  PHP INI Read and Write Class  >  Download Download .zip .tar.gz  >  Support forum Support forum (1)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP INI Read and Write Class
Base name: php-ini-class
Description: Read and write configuration values in INI files
Version: 1.0
PHP version: 4.0.4
License: GNU General Public License (GPL)
All time users: 946 users
All time rank: 3682
Week users: 3 users
Week rank: 277 Up
 
  Groups   Rate classes User ratings   Applications   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Files and Folders Listing, accessing and manipulating files and folders View top rated classes
Group folder image Configuration Configuration formats parsing and generation View top rated classes


  User ratings  
Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Accessible without login Plain text file config.ini Data INI sample
Accessible without login Plain text file example.php Example Example script
Plain text file INI.class.php Class Class file
Accessible without login Plain text file README.md Data Auxiliary data

Install with Composer Install with Composer - Download Download all files: php-ini-class.tar.gz php-ini-class.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.