PHPackages                             panda843/ini - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. panda843/ini

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

panda843/ini
============

3.0.5(3y ago)0141LGPL-3.0PHPPHP &gt;=7.2

Since Jan 7Pushed 3y agoCompare

[ Source](https://github.com/panda843/component-ini)[ Packagist](https://packagist.org/packages/panda843/ini)[ RSS](/packages/panda843-ini/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (21)Used By (0)

Matomo/Ini
==========

[](#matomoini)

Read and write INI configurations.

[![Build Status](https://camo.githubusercontent.com/c0c9a52fd91aef4ceca971a4abec74733cc10adc3441b65887f5eef080fb6653/68747470733a2f2f7472617669732d63692e636f6d2f6d61746f6d6f2d6f72672f636f6d706f6e656e742d696e692e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/matomo-org/component-ini)[![Latest Version](https://camo.githubusercontent.com/482024b07cf89a11e84b019381ef144a2836402109702947a60c23b9efba75a3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6d61746f6d6f2d6f72672f636f6d706f6e656e742d696e692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/matomo/component-ini)[![](https://camo.githubusercontent.com/82d1e34cbbf680534774c75fd80612c292499d8c771db40878c645ebd3c92268/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d61746f6d6f2f696e692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/matomo/ini)

Installation
------------

[](#installation)

```
composer require panda843/ini
```

Why?
----

[](#why)

PHP provides a `parse_ini_file()` function to read INI files.

This component provides the following benefits over the built-in function:

- allows to write INI files
- classes can be used with dependency injection and mocked in unit tests
- throws exceptions instead of PHP errors
- better type supports:
    - parses boolean values (`true`/`false`, `on`/`off`, `yes`/`no`) to real PHP booleans ([instead of strings `"1"` and `""`](http://3v4l.org/JuvOT))
    - parses null to PHP `null` ([instead of an empty string](http://3v4l.org/KSoj2))
- works even if `parse_ini_file()` or `parse_ini_string()` is disabled in `php.ini` by falling back on an alternate implementation (can happen on some shared hosts)

Usage
-----

[](#usage)

### Read

[](#read)

```
$reader = new IniReader();

// Read a string
$array = $reader->readString($string);

// Read a file
$array = $reader->readFile('config.ini');
```

#### Troubleshooting

[](#troubleshooting)

**unexpected BOOL\_TRUE in Unknown on line X**

The PHP default implementation of read\_ini\_file does not allow bool-ish values as keys in when reading ini files.

Data like `yes = "Yes"` results in the following error:

```
Syntax error in INI configuration: syntax error, unexpected BOOL_TRUE in Unknown on line 6

```

To prevent from that error, please switch to the custom ini reader implementation by using:

```
$reader = new IniReader();
$reader->setUseNativeFunction(false);
```

### Write

[](#write)

```
$writer = new IniWriter();

// Write to a string
$string = $writer->writeToString($array);

// Write to a file
$writer->writeToFile('config.ini', $array);
```

License
-------

[](#license)

The Ini component is released under the [LGPL v3.0](http://choosealicense.com/licenses/lgpl-3.0/).

Contributing
------------

[](#contributing)

To run the unit tests:

```
vendor/bin/phpunit

```

To run the performance tests:

```
php vendor/bin/phpbench run tests/PerformanceTest --report=default

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~159 days

Recently: every ~0 days

Total

18

Last Release

1444d ago

Major Versions

1.0.6 → 2.0.02018-02-14

1.0.8 → 2.0.22020-01-12

2.0.2 → 3.0.02021-06-17

PHP version history (2 changes)1.0.0PHP &gt;=5.3.3

3.0.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/88f7c9e0ea6ecf147c2ce02534206ae9b43770b36c7ac8b82f2fe87a3b7a22cf?d=identicon)[panda843](/maintainers/panda843)

---

Top Contributors

[![mnapoli](https://avatars.githubusercontent.com/u/720328?v=4)](https://github.com/mnapoli "mnapoli (30 commits)")[![tsteur](https://avatars.githubusercontent.com/u/273120?v=4)](https://github.com/tsteur "tsteur (10 commits)")[![sgiehl](https://avatars.githubusercontent.com/u/1579355?v=4)](https://github.com/sgiehl "sgiehl (8 commits)")[![panda843](https://avatars.githubusercontent.com/u/7259406?v=4)](https://github.com/panda843 "panda843 (8 commits)")[![typomedia](https://avatars.githubusercontent.com/u/5276515?v=4)](https://github.com/typomedia "typomedia (5 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")[![diosmosis](https://avatars.githubusercontent.com/u/125140?v=4)](https://github.com/diosmosis "diosmosis (2 commits)")[![dhirtzbruch](https://avatars.githubusercontent.com/u/426308?v=4)](https://github.com/dhirtzbruch "dhirtzbruch (2 commits)")[![Findus23](https://avatars.githubusercontent.com/u/6266037?v=4)](https://github.com/Findus23 "Findus23 (1 commits)")[![c960657](https://avatars.githubusercontent.com/u/111346?v=4)](https://github.com/c960657 "c960657 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/panda843-ini/health.svg)

```
[![Health](https://phpackages.com/badges/panda843-ini/health.svg)](https://phpackages.com/packages/panda843-ini)
```

###  Alternatives

[delight-im/base64

Simple and convenient Base64 encoding and decoding for PHP

15158.1k6](/packages/delight-im-base64)[xelson/flarum-ext-chat

Realtime Chat for Flarum!

229.7k](/packages/xelson-flarum-ext-chat)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
