PHPackages                             mayoturis/properties-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. mayoturis/properties-ini

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

mayoturis/properties-ini
========================

Getting and setting configuration values in ini (or java .properties) files

1.0(10y ago)2118.5k↓100%1MITPHPPHP &gt;=5.4.0

Since Nov 16Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (2)Used By (0)

PHP configuration writer and reader
===================================

[](#php-configuration-writer-and-reader)

Allows to get and set configuration variables stored in ini-like (or java .properties) files

### Installation with composer

[](#installation-with-composer)

`composer require mayoturis/properties-ini`

or

```
{
    "require": {
        "mayoturis/properties-ini": "1.0"
    }
}
```

### Usage

[](#usage)

\####Basic Example

```
$config = Mayoturis\Properties\RepositoryFactory::make('path_to_configuration_file');
$config->get('DB_PASSWORD');
$config->set('DB_STRICT_MODE', true);
```

#### File format

[](#file-format)

Reader can load these types of lines

```
DB_HOST=localhost           // loaded as string 'localhost'
DB_USERNAME="user"          // string 'user'
DB_PASSWORD = 'password'    // string 'password'
DB_STRICT_MODE=true         // boolean true

FLOAT_VALUE=1.1             // float 1.1
INT_VALUE=1                 // int 1
NULL_VALUE=null             // null

# comment                   // won't be loaded
; comment                   // won't be loaded
//comment                   // won't be loaded

```

Comment has to be at the start of the line

#### Example of file loading

[](#example-of-file-loading)

```
name="John"
surname=Doe
age=25
salary=12.5
married=false
wife=null

```

Will be loaded as

```
[
  "name"    => "John",
  "surname" => "Doe",
  "age"     => 25,
  "salary"  => 12.5
  "married" => false,
  "wife"    => null
]
```

#### Saving configuration

[](#saving-configuration)

When saving the configuration, file format will be respected. Therefore empty lines and comments will preserved. New values (NOT only changed) will be placed at the end of the file

#### Further examples

[](#further-examples)

###### Get all configuration values

[](#get-all-configuration-values)

```
$config = Mayoturis\Properties\RepositoryFactory::make('path_to_configuration_file');
$configurationArray = $config->all();
```

###### Setting value

[](#setting-value)

```
// file .env

name=John
surname="Doe"

# In 2015
age=25

```

```
// file index.php

$config = Mayoturis\Properties\RepositoryFactory::make(__DIR__ . '/.env');
$config->set('name', 'Johny');
$config->set('age', 35);
```

```
// file .env after

name=Johny
surname="Doe"

# In 2015
age=35

```

###### Save all configuration values

[](#save-all-configuration-values)

```
$configArray = [
  "username" => "user",
  "password" => "password"
];

$config = Mayoturis\Properties\RepositoryFactory::make('path_to_configuration_file');
$config->setAll($configArray);
```

Notice: setAll function will override all configuration values. Previous values will be lost.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3826d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cbfda636207aadb6cceeb59ddb993363796d2bdf1bf5c346ac10a5459ea26429?d=identicon)[mayoturis](/maintainers/mayoturis)

---

Top Contributors

[![mayoturis](https://avatars.githubusercontent.com/u/8339072?v=4)](https://github.com/mayoturis "mayoturis (6 commits)")

---

Tags

phpconfigurationconfigpropertiesini

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[m1/vars

Vars is a simple to use and easily extendable configuration loader with in built loaders for ini, json, PHP, toml, XML and yaml/yml file types. It also comes with in built support for Silex and more frameworks to come soon.

69124.2k1](/packages/m1-vars)[davidepastore/slim-config

A slim middleware to read configuration from different files based on hassankhan/config

338.9k1](/packages/davidepastore-slim-config)

PHPackages © 2026

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