PHPackages                             jsc-php/configs - 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. jsc-php/configs

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

jsc-php/configs
===============

Config file parser and writer

v0.1.1(4mo ago)035GPL-3.0PHPPHP ^8.5

Since Mar 3Pushed 4mo agoCompare

[ Source](https://github.com/jsc-php/Configs)[ Packagist](https://packagist.org/packages/jsc-php/configs)[ GitHub Sponsors](https://github.com/sponsors/jsc-php)[ RSS](/packages/jsc-php-configs/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (3)Used By (0)

Configs
=======

[](#configs)

A simple and flexible PHP library for parsing and writing configuration files. Supports JSON, YAML, INI, and XML formats with ease.

Features
--------

[](#features)

- **Multi-format Support**: Seamlessly handle `.json`, `.yaml`, `.ini`, `.php`, and `.xml` files.
- **Magic Access**: Access and modify configuration data using PHP magic properties.
- **Auto-save**: Automatically persists changes back to the file when the object is destroyed (can be disabled)[1](#user-content-fn-1-1287edc7cb92ed76875db6948fee2971).
- **Format Conversion**: Easily convert configuration files between supported formats.
- **Type Safety**: Built for PHP 8.5+ with modern syntax.

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

[](#installation)

Install via Composer:

```
composer require jsc-php/configs
```

*Note: Requires the `ext-yaml` PHP extension for YAML support.*

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

```
use JscPhp\Configs\Config;

// Load a config file (format is determined by file extension)
$config = new Config('test.php');

// Get values using magic methods
$db = $config->database;
$db_host = $config->database['host'];

// Get values using get function
$db = $config->get('database');
$db_host = $config->get('database')['host'];
$db_host = $config->get('database','host');
$db_host = $config->get('database.host');

// Set values
$config->debug = true;
$config->set('debug', true);
$config->set('debug.level', 'info');
$config->set(['debug','level'], 'info');

// Changes are automatically saved when $config goes out of scope
```

### Options

[](#options)

You can disable autosave in the constructor:

```
$config = new Config('config.yaml', ['autosave' => false]);

$config->theme = 'dark';

// Manual save required if autosave is false
$config->save();
```

### Converting Formats

[](#converting-formats)

Convert an existing configuration to a different format:

```
use JscPhp\Configs\Config;
use JscPhp\Configs\Types\Type;

$config = new Config('settings.ini');

// Save as JSON
$config->saveAs('settings.json');
```

### Deleting Keys

[](#deleting-keys)

```
$config->delete('key1'); //Deletes array key1
$config->delete('key1.key2'); //Deletes array key2 within key1
$config->delete('key1','key2'); //Deletes array key2 within key1
```

Supported Formats
-----------------

[](#supported-formats)

- **JSON**: Uses native `json_encode` and `json_decode`.
- **YAML**: Uses `yaml_emit` and `yaml_parse` (requires `ext-yaml`).
- **INI**: Uses `parse_ini_file` with typed scanning and a custom writer supporting sections and multi-value keys.
- **PHP**: Uses `var_export()` to create a return value
- **XML**: Uses `SimpleXML` for parsing and DOM for formatted output with proper indentation.

License
-------

[](#license)

This project is licensed under the GPL-3.0 License.

Authors
-------

[](#authors)

- **James Cavaliere** -

Footnotes
---------

1. To save changes, the config file must be writable [↩](#user-content-fnref-1-1287edc7cb92ed76875db6948fee2971)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance78

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Total

2

Last Release

120d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/32767854a04a19683365ea864694922d19a0bb8511f4b1d7ecb28500e039e185?d=identicon)[jsc-php](/maintainers/jsc-php)

---

Top Contributors

[![jsc-php](https://avatars.githubusercontent.com/u/41808297?v=4)](https://github.com/jsc-php "jsc-php (37 commits)")

### Embed Badge

![Health badge](/badges/jsc-php-configs/health.svg)

```
[![Health](https://phpackages.com/badges/jsc-php-configs/health.svg)](https://phpackages.com/packages/jsc-php-configs)
```

###  Alternatives

[ryanpotter/silverstripe-cms-theme

CMS Theme

39278.3k5](/packages/ryanpotter-silverstripe-cms-theme)[cristal/pptx

PHP library for manipulating PowerPoint (PPTX) files

2762.5k](/packages/cristal-pptx)[medienbaecker/kirby-modules

Easily add modules to your pages

895.5k1](/packages/medienbaecker-kirby-modules)[visavi/cleanup

Cleaning vendor directory

2356.1k6](/packages/visavi-cleanup)

PHPackages © 2026

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