All Projects → Magicalex → Writeinifile

Magicalex / Writeinifile

Licence: gpl-3.0
Write-ini-file php library for create, remove, erase, add, and update ini file

Labels

Projects that are alternatives of or similar to Writeinifile

plaster
Application config settings abstraction layer.
Stars: ✭ 19 (+58.33%)
Mutual labels:  ini
initool
Manipulate INI files from the command line
Stars: ✭ 40 (+233.33%)
Mutual labels:  ini
Toou 2d
基于Qt Quick(Qml) 跨平台技术打造的2D框架
Stars: ✭ 413 (+3341.67%)
Mutual labels:  ini
share
A collection of libraries and tools written in Go.
Stars: ✭ 35 (+191.67%)
Mutual labels:  ini
parse it
A python library for parsing multiple types of config files, envvars & command line arguments that takes the headache out of setting app configurations.
Stars: ✭ 86 (+616.67%)
Mutual labels:  ini
config-parser
A slim, fully managed C# library for reading/writing .ini, .conf, .cfg etc configuration files.
Stars: ✭ 67 (+458.33%)
Mutual labels:  ini
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (+500%)
Mutual labels:  ini
Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (+5258.33%)
Mutual labels:  ini
Slim-Config
A file configuration loader that supports PHP, INI, XML, JSON, and YML files for the Slim Framework. It internally uses https://github.com/hassankhan/config.
Stars: ✭ 28 (+133.33%)
Mutual labels:  ini
Crudini
A utility for manipulating ini files
Stars: ✭ 292 (+2333.33%)
Mutual labels:  ini
libconfini
Yet another INI parser
Stars: ✭ 106 (+783.33%)
Mutual labels:  ini
libconfigini
Configuration parser library in INI format
Stars: ✭ 32 (+166.67%)
Mutual labels:  ini
SNAP
Easy data format saving and loading for GameMaker Studio 2.3.2
Stars: ✭ 49 (+308.33%)
Mutual labels:  ini
resource-translator
A GitHub Action that automatically creates machine-translated PRs of translation files. Supported file formats include, .ini, .po, .restext, .resx, .xliff .json.
Stars: ✭ 44 (+266.67%)
Mutual labels:  ini
Sharpconfig
An easy to use CFG/INI configuration library for .NET.
Stars: ✭ 442 (+3583.33%)
Mutual labels:  ini
database-js
Common Database Interface for Node
Stars: ✭ 58 (+383.33%)
Mutual labels:  ini
Config
PHP library for simple configuration management
Stars: ✭ 39 (+225%)
Mutual labels:  ini
Structured Text Tools
A list of command line tools for manipulating structured text data
Stars: ✭ 6,180 (+51400%)
Mutual labels:  ini
Goconfig
Package goconfig is a fully functional and comments-support configuration file (.ini) parser.
Stars: ✭ 568 (+4633.33%)
Mutual labels:  ini
simple-ini-reader
Fast, Simple, Public Domain INI Reader written in C
Stars: ✭ 17 (+41.67%)
Mutual labels:  ini

WriteiniFile

Write-ini-file php library for create, remove, erase, add, and update ini file.

Build Status Coverage Status StyleCI Latest Stable Version Total Downloads License

Installation

Use composer for install magicalex/write-ini-file.

composer require magicalex/write-ini-file

Usage

<?php

require_once 'vendor/autoload.php';

use \WriteiniFile\WriteiniFile;
use \WriteiniFile\ReadiniFile;

$data = [
    'fruit' => ['orange' => '100g', 'fraise' => '10g'],
    'legume' => ['haricot' => '20g', 'oignon' => '100g'],
    'jus' => ['orange' => '1L', 'pomme' => '1,5L', 'pamplemousse' => '0,5L'],
];

// demo create ini file
$file = new WriteiniFile('file.ini');
$file
    ->create($data)
    ->add(['music' => ['rap' => true, 'rock' => false]])
    ->rm(['jus' => ['pomme' => '1,5L']])
    ->update(['fruit' => ['orange' => '200g']])
    ->write();

echo '<pre>'.file_get_contents('file.ini').'</pre>';
/* output file.ini
[fruit]
orange=200g
fraise=10g

[legume]
haricot=20g
oignon=100g

[jus]
orange=1L
pamplemousse=0,5L

[music]
rap=true
rock=false
*/

// Just read a file ini
var_dump(ReadiniFile::get('file.ini'));
/* output
array(4) {
  'fruit' => array(2) {
    'orange' => string(4) "200g"
    'fraise' => string(3) "10g"
  }
  'legume' => array(2) {
    'haricot' => string(3) "20g"
    'oignon' => string(4) "100g"
  }
  'jus' => array(2) {
    'orange' => string(2) "1L"
    'pamplemousse' => string(4) "0,5L"
  }
  'music' => array(2) {
    'rap' => string(4) "true"
    'rock' => string(5) "false"
  }
}
*/

$erase = (new WriteiniFile('file.ini'))->erase()->write();
// file.ini -> empty

Contributing

To run the unit tests:

composer install
php vendor/bin/phpunit # or use: composer run-script test

License

WriteiniFile is released under the GNU General Public License v3.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].