PHP Classes

PHP INI Editor Class: View and edit INI files in Web forms

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 467 All time: 6,038 This week: 59Up
Version License PHP version Categories
inieditor 1.0.3GNU General Publi...5PHP 5, Files and Folders, Content man..., C..., P...
Description 

Author

This class can be used to view and edit INI files in Web forms.

It generates HTML and JavaScript using jQuery and Bootstrap to display INI files, as well let the user interactively edit the INI files sections and variable values.

It provides means to add sections, fields and values of types: text, boolean, array.

The edited version is saved to a given in the destination directory. The previous version is saved to a backup file before saving a new version.

Innovation Award
PHP Programming Innovation award nominee
February 2017
Number 5


Prize: 1 year subscription to the Basic Plan of an API product of choice
This INI format is very popular for storing and retrieving configuration information.

There are many packages for editing INI files. This package provide an interactive way to edit INI files using Web forms to display and edit INI files sections and configuration values.

Manuel Lemos
Picture of Blupixel IT Srl
Name: Blupixel IT Srl <contact>
Classes: 1 package by
Country: Italy Italy
Age: ???
All time rank: 3359132 in Italy Italy
Week rank: 206 Up14 in Italy Italy Up
Innovation award
Innovation award
Nominee: 1x

Recommendations

read and write ini file
Create a web page that manages a .ini file

Example

<?php
/* -------------------------------------------------------------------
 *
 * Author: Blupixel IT Srl
 * Last Modifcation Date: 23 Jan 2017
 * Website: www.blupixelit.eu
 * support at: support@blupixelit.eu
 *
 * Copyright (c) 2017 Blupixel IT Srl - Trento (Italy)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
?>
<!DOCTYPE>
<head>
</head>
<html>
    <body>
        <?php

       
// include the class
       
include('IniEditor.class.php');

       
// initialize the class object
       
$ini_editor = new IniEditor();

       
// include Javascript and CSS from jQuery and Bootstrap CDN
       
echo IniEditor::getCssJsInclude();
       
       
// include class CSS (use your own if you prefer)
       
echo IniEditor::getCSS();

       
// set folder where to put backups before saving the new version of the file (folder needs write permissions)
       
$ini_editor->setBackupFolder('backups');
       
       
// set different Scanner Mode (optional)
       
$ini_editor->setScannerMode(INI_SCANNER_RAW);
       
       
// set the path of the file you want to edit or view
       
$ini_editor->setIniFile('default.ini');
       
       
// set to true to allow edit of the config file (default is true)
       
$ini_editor->enableEdit(true);
               
       
// set to true to allow add of sections and conf in the config file (default is true)
       
$ini_editor->enableAdd(true);
       
       
// set to true to allow delete of conf in the config file (default is true)
       
$ini_editor->enableDelete(true);

       
// print the form. Use $ini_editor->getForm() to store it in a variable
       
$ini_editor->printForm();

       
?>
</body>
</html>


Details

/* ------------------------------------------------------------------- * * Author: Blupixel IT Srl * Last Modifcation Date: 23 Jan 2017 * Website: www.blupixelit.eu * support at: support@blupixelit.eu * * Copyright (c) 2017 Blupixel IT Srl - Trento (Italy) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * This class provide an easy editor for ini files * * Use it as described in the sample.php file or using the code below * Remeber to give write permission to the ini file and to the backup folder * */ Example of use: <?php include('IniEditor.class.php'); // initialize the class object $ini_editor = new IniEditor(); // include Javascript and CSS from jQuery and Bootstrap CDN echo IniEditor::getCssJsInclude(); // include class CSS (use your own if you prefer) echo IniEditor::getCSS(); // set folder where to put backups before saving the new version of the file (folder needs write permissions) $ini_editor->setBackupFolder('backups'); // set different Scanner Mode (optional) $ini_editor->setScannerMode(INI_SCANNER_RAW); // set the path of the file you want to edit or view $ini_editor->setIniFile('default.ini'); // set to true to allow edit of the config file (default is true) $ini_editor->enableEdit(true); // set to true to allow add of sections and conf in the config file (default is true) $ini_editor->enableAdd(true); // set to true to allow delete of conf in the config file (default is true) $ini_editor->enableDelete(true); // print the form. Use $ini_editor->getForm() to store it in a variable $ini_editor->printForm(); ?>

Screenshots (3)  
  • Screenshot.png
  • Screenshot2.png
  • Screenshot_edit.png
  Files folder image Files (7)  
File Role Description
Accessible without login Plain text file default.ini Data .ini file example
Plain text file IniEditor.class.php Class Main class of the package
Accessible without login Plain text file README.txt Doc. Readme file
Accessible without login Plain text file sample.php Example Use sample file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:467
This week:0
All time:6,038
This week:59Up