PHPackages                             amattu2/ini-parser - 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. amattu2/ini-parser

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

amattu2/ini-parser
==================

A PHP-7 .ini file parser built with error-redundancies

v1.0.1(3y ago)028AGPL-3.0-or-laterPHP

Since Jun 5Pushed 3y ago1 watchersCompare

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

READMEChangelog (5)DependenciesVersions (5)Used By (0)

Introduction
============

[](#introduction)

This is a basic configuration/`.ini` file parser built with PHP. It's designed to be error-safe, and provides the opportunity to use a default value if one is not found.

Usage
=====

[](#usage)

Install
-------

[](#install)

```
composer require amattu/IniParser
```

Setup
-----

[](#setup)

Composer project usage

```
require(__DIR__ . "/vendor/autoload.php");

$config = new amattu\IniParser(__DIR__ . "/conf.ini");
```

Without composer

```
require(__DIR__ . "/src/IniParser.php");

$config = new amattu\IniParser(__DIR__ . "/conf.ini");
```

construct
---------

[](#construct)

The class constructor accepts the file location (path + name), and an optional boolean argument on parsing the individual sections (usually denoted by `[NAME]`).

### PHPDoc

[](#phpdoc)

```
/**
 * Configuration reader constructor
 *
 * @param string $file The path to the configuration file
 * @param ?bool $sections Whether to parse individual sections or not
 * @throws TypeError
 * @author Alec M.
 */
public function __construct(string $filename, ?bool $sections = false)
```

---

get
---

[](#get)

The `get` function will attempt to pull the value from the section specified (... if specified), and if not found, will return the default parameter. All of the arguments except `$key` are optional.

### Usage

[](#usage-1)

```
$usernameOrDefault = $config->get("USERNAME", "GMAIL_SECTION", "defaultUserName");
```

### PHPDoc

[](#phpdoc-1)

```
/**
 * Get configuration file property
 *
 * @param string $key The property to get
 * @param string|null $section The section to get the property from
 * @param ?mixed $default value to return if the property is not found
 * @return $config[$key] || $default || null
 * @throws TypeError
 * @author Alec M.
 */
public function get(string $key, ?string $section = null, ?mixed $default = null) : mixed
```

Requirements &amp; Dependencies
===============================

[](#requirements--dependencies)

- PHP 7.x +

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~92 days

Total

4

Last Release

1164d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/45d27ac587ba85712309c969ca2e277df1044c60ce9f2f8a5ca69118211e30d6?d=identicon)[amattu2](/maintainers/amattu2)

---

Top Contributors

[![amattu2](https://avatars.githubusercontent.com/u/38357871?v=4)](https://github.com/amattu2 "amattu2 (11 commits)")

### Embed Badge

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

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

PHPackages © 2026

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