PHPackages                             periwinkle/array-config - 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. periwinkle/array-config

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

periwinkle/array-config
=======================

Allows for using native PHP files as config files in PHP

1.0.1(11y ago)54351MITPHP &gt;=3

Since Nov 7Pushed 8y ago3 watchersCompare

[ Source](https://github.com/mrkrstphr/array-config)[ Packagist](https://packagist.org/packages/periwinkle/array-config)[ RSS](/packages/periwinkle-array-config/feed)WikiDiscussions master Synced 1mo ago

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

periwinkle/array-config
=======================

[](#periwinklearray-config)

> Allows for using native PHP files as config files in PHP!

Using YAML and XML as configuration scripts in PHP projects has become prolific. However, this comes with the overhead of having to validate, process, and convert those configuration files to PHP to be used.

What if you could just use native PHP arrays for configuration files?

**Now you can!**

periwinkle/array-config brings revolutionary support to PHP to use PHP in PHP.

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

[](#installation)

periwinkle/array-config can be installed via Composer:

```
composer require periwinkle/array-config

```

Usage
-----

[](#usage)

Let's say you had a configuration file written in Yaml:

```
database:
  driver: pgsql
  host: localhost
  name: awesomedb
  user: awesomesauce
  password: mustangSally
```

With periwinkle/array-config, you can now write this configuration file as pure PHP!

```
return [
    'database' => [
        'driver' => 'pgsql',
        'host' => 'localhost',
        'name' => 'awesomedb',
        'user' => 'awesomesauce',
        'password' => 'mustangSally'
    ]
];
```

To use this config file, simply:

```
$config = include 'configs/database.php';
```

No need to parse Yaml! No need to parse Xml!

### Older Versions of PHP

[](#older-versions-of-php)

array-config is so revolutionary, we've added support going all the way back to PHP 3! The examples above use the short array syntax introduced in PHP 5.4. If you're living in the past, you can still use array-config\*:

```
return array(
    'database' => array(
        'driver' => 'pgsql',
        'host' => 'localhost',
        'name' => 'awesomedb',
        'user' => 'awesomesauce',
        'password' => 'mustangSally'
    )
);
```

Usage:

```
$config = include 'configs/database.php';
```

\* Note: Composer will not work with some older versions. For those versions, feel free to copy the array-config source code to a directory within your project. Any directory will do; we suggest a `functions/` or `includes/` directory if you have one.

Framework Support
-----------------

[](#framework-support)

Ping your favorite neighborhood framework developer, and tell them you want the ability to use native PHP config files in their projects!

Join the array party!
---------------------

[](#join-the-array-party)

- [PhpUnit/DbUnit Fixtures](https://github.com/mrkrstphr/dbunit-fixture-arrays): Provides support for native PHP array based fixtures for DbUnit.

Seriously
---------

[](#seriously)

Yeah, I know you can just cache the result of the Yaml or Xml parsing so that it doesn't have to be done over and over again, but there's no valid reason to use it in the first place.

**Just use PHP.**

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% 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 ~0 days

Total

2

Last Release

4210d ago

### Community

Maintainers

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

---

Top Contributors

[![mrkrstphr](https://avatars.githubusercontent.com/u/164472?v=4)](https://github.com/mrkrstphr "mrkrstphr (8 commits)")[![Bilge](https://avatars.githubusercontent.com/u/470626?v=4)](https://github.com/Bilge "Bilge (1 commits)")

### Embed Badge

![Health badge](/badges/periwinkle-array-config/health.svg)

```
[![Health](https://phpackages.com/badges/periwinkle-array-config/health.svg)](https://phpackages.com/packages/periwinkle-array-config)
```

###  Alternatives

[phpdocumentor/reflection-docblock

With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.

9.4k722.2M1.2k](/packages/phpdocumentor-reflection-docblock)[beste/json

A simple JSON helper to decode and encode JSON

4222.7M3](/packages/beste-json)

PHPackages © 2026

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