# WriteiniFile **Repository Path**: public999/WriteiniFile ## Basic Information - **Project Name**: WriteiniFile - **Description**: No description available - **Primary Language**: PHP - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-03-25 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## WriteiniFile Write-ini-file php library for create, remove, erase, add, and update ini file. [](https://travis-ci.org/Magicalex/WriteiniFile) [](https://coveralls.io/github/Magicalex/WriteiniFile?branch=master) [](https://styleci.io/repos/36994392) [](https://packagist.org/packages/magicalex/write-ini-file) [](https://packagist.org/packages/magicalex/write-ini-file) [](https://packagist.org/packages/magicalex/write-ini-file) [](https://packagist.org/packages/magicalex/write-ini-file) ## Installation Use composer for install this library. ```bash $ composer require magicalex/write-ini-file:1.2.* ``` ## Usage ```php ['orange' => '100g', 'fraise' => '10g'], 'legume' => ['haricot' => '20g', 'oignon' => '100g'], 'jus' => ['orange' => '1L', 'pomme' => '1,5L', 'pamplemousse' => '0,5L'], ]; // demo create ini file $a = new WriteiniFile('file.ini'); $a->create($data); $a->add([ 'music' => ['rap' => true, 'rock' => false] ]); $a->rm([ 'jus' => ['pomme' => '1,5L'] ]); $a->update([ 'fruit' => ['orange' => '200g'] // 100g to 200g ]); $a->write(); echo '
'.file_get_contents('file.ini').'';
/* output file.ini
[fruit]
orange = "200g"
fraise = "10g"
[legume]
haricot = "20g"
oignon = "100g"
[jus]
orange = "1L"
pamplemousse = "0,5L"
[music]
rap = 1
rock = 0
*/
$b = new WriteiniFile('file.ini');
$b->erase();
$b->write();
// file.ini -> empty
```
## Contributing
To run the unit tests:
```bash
$ composer install
$ php vendor/bin/phpunit
```
## License
The WriteiniFile php library is released under the GNU General Public License v3.0.
https://github.com/Magicalex/WriteiniFile/blob/master/LICENSE.md