PHPackages                             aedart/config-loader - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. aedart/config-loader

Abandoned → [aedart/athenaeum](/?search=aedart%2Fathenaeum)ArchivedLibrary[Parsing &amp; Serialization](/categories/parsing)

aedart/config-loader
====================

Utility for loading various types of configuration files and parse them to a Laravel Configuration Repository

5.1.0(7y ago)392411BSD-3-ClausePHPPHP &gt;=7.1.0

Since Oct 21Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (7)Versions (13)Used By (1)

[![Build Status](https://camo.githubusercontent.com/5533459b2788019cfb9ee1d34eeaad389c4885f54ecd955f2162511690d10d79/68747470733a2f2f7472617669732d63692e6f72672f6165646172742f636f6e6669672d6c6f616465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/aedart/config-loader)[![Latest Stable Version](https://camo.githubusercontent.com/0430f3709b4770b3674868e3c9448475b0cd75f9bf46138e667beed7a7cd60c2/68747470733a2f2f706f7365722e707567782e6f72672f6165646172742f636f6e6669672d6c6f616465722f762f737461626c65)](https://packagist.org/packages/aedart/config-loader)[![Total Downloads](https://camo.githubusercontent.com/3365644042a11567a3f3bf70045b57df95f86bcdf7634ed90c3444ccdb07a840/68747470733a2f2f706f7365722e707567782e6f72672f6165646172742f636f6e6669672d6c6f616465722f646f776e6c6f616473)](https://packagist.org/packages/aedart/config-loader)[![Latest Unstable Version](https://camo.githubusercontent.com/58f306752e36a397b5b2f209bd6d2bd42b598a8c1b2ff67a1244733b67d159a2/68747470733a2f2f706f7365722e707567782e6f72672f6165646172742f636f6e6669672d6c6f616465722f762f756e737461626c65)](https://packagist.org/packages/aedart/config-loader)[![License](https://camo.githubusercontent.com/4ad3f17b7fbda0553bb08527056463a51d129ee6f8bcd16a2c312642210499df/68747470733a2f2f706f7365722e707567782e6f72672f6165646172742f636f6e6669672d6c6f616465722f6c6963656e7365)](https://packagist.org/packages/aedart/config-loader)

Deprecated- Config Loader
=========================

[](#deprecated--config-loader)

Package has been replaced by [aedart/athenaeum](https://github.com/aedart/athenaeum)

A utility for loading various types of configuration files and parse them to a Laravel Configuration Repository. This package contains a set of default file-parsers, which can be applied. However, if you have a need for a different kind of parser, then you can "simply" create one, add it to the loader.

Contents
========

[](#contents)

- [When to use this](#when-to-use-this)
- [How to install](#how-to-install)
- [Quick start](#quick-start)
    - [Supported file types](#supported-file-types)
    - [Inside a Laravel project](#inside-a-laravel-project)
    - [Outside a Laravel project](#outside-a-laravel-project)
    - [Load and parse a single file](#load-and-parse-a-single-file)
    - [How to access the configuration](#how-to-access-the-configuration)
    - [Custom configuration file parser](#custom-configuration-file-parser)
- [Contribution](#contribution)
- [Acknowledgement](#acknowledgement)
- [Versioning](#versioning)
- [License](#license)

When to use this
----------------

[](#when-to-use-this)

- When you need to load configuration from a file
- (When you need to load configuration from multiple files)

How to install
--------------

[](#how-to-install)

```
composer require aedart/config-loader
```

This package uses [composer](https://getcomposer.org/). If you do not know what that is or how it works, I recommend that you read a little about, before attempting to use this package.

Quick start
-----------

[](#quick-start)

### Supported file types

[](#supported-file-types)

File ExtensionParser\*.ini\\Aedart\\Config\\Loader\\Parsers\\Ini\*.json\\Aedart\\Config\\Loader\\Parsers\\Json\*.php (php array)\\Aedart\\Config\\Loader\\Parsers\\PHPArray\*.yml (also \*.yaml)\\Aedart\\Config\\Loader\\Parsers\\Yaml### Inside a Laravel project

[](#inside-a-laravel-project)

#### Service Provider

[](#service-provider)

The first thing you need to to, is to register the service provider;

```
\Aedart\Config\Loader\Providers\ConfigurationLoaderServiceProvider::class
```

#### Load configuration

[](#load-configuration)

After you have specified the service provider, you can use the loader. In the following example, a directory path is provided and the files contained in that directory are loaded and parsed;

```
use Aedart\Config\Loader\Loaders\ConfigLoader;

// Path to some directory that contains the configuration file(s)
$path = 'config/';

// Create a new loader instance
$loader = new ConfigLoader($path);

// Load and parse the configuration files
// NB: Is added directly to Laravel's configuration, can be accessed normally via the Config facade...
$loader->load();

// Obtain the configuration repository
$config = $loader->getConfig();
```

### Outside a Laravel project

[](#outside-a-laravel-project)

When working outside a Laravel project, you need to create a few more instances, which the loader is dependent upon;

```
use Aedart\Config\Loader\Loaders\ConfigLoader;
use Aedart\Config\Loader\Factories\DefaultParserFactory;
use Illuminate\Config\Repository;
use Illuminate\Filesystem\Filesystem;

// Path to some directory that contains the configuration file(s)
$path = 'config/';

// Create a new loader instance
$loader = new ConfigLoader($path);

// Specify the required dependencies
$loader->setConfig(new Repository());
$loader->setFile(new Filesystem());
$loader->setParserFactory(new DefaultParserFactory());

// Load and parse the configuration files
$loader->load();

// Obtain the configuration repository
$config = $loader->getConfig();
```

### Load and parse a single file

[](#load-and-parse-a-single-file)

You can also load and parse a single file, instead of an entire directory;

```
// Provided you have created an instance of the configuration loader,
// simply specify the full path to the configuration file
$config = $loader->parse('config/users.yml');
```

### How to access the configuration

[](#how-to-access-the-configuration)

If you are not familiar with Laravel's configuration repository, please review its [documentation](https://laravel.com/docs/5.4/configuration#accessing-configuration-values).

*Example PHP Array configuration file*

*(config/users.php)*

```
return [
    'message' => 'Hallo World'
];
```

*Example of accessing the `message`*

```
// ... (loading and parsing not shown) ...

// Fetch the message key
$message = $config->get('users.message');

echo $message; // Outputs 'Hallo World'
```

### Custom configuration file parser

[](#custom-configuration-file-parser)

If you need a custom parser, then you can create one by implementing the `\Aedart\Config\Loader\Contracts\Parsers\Parser` interface.

However, you also need to add your parser to a `parser factory`. Please review the `\Aedart\Config\Loader\Contracts\Factories\ParserFactory` interface, as well as the default factory provided in this package; `\Aedart\Config\Loader\Factories\DefaultParserFactory`

Contribution
------------

[](#contribution)

Have you found a defect ( [bug or design flaw](https://en.wikipedia.org/wiki/Software_bug) ), or do you wish improvements? In the following sections, you might find some useful information on how you can help this project. In any case, I thank you for taking the time to help me improve this project's deliverables and overall quality.

### Bug Report

[](#bug-report)

If you are convinced that you have found a bug, then at the very least you should create a new issue. In that given issue, you should as a minimum describe the following;

- Where is the defect located
- A good, short and precise description of the defect (Why is it a defect)
- How to replicate the defect
- (*A possible solution for how to resolve the defect*)

When time permits it, I will review your issue and take action upon it.

### Fork, code and send pull-request

[](#fork-code-and-send-pull-request)

A good and well written bug report can help me a lot. Nevertheless, if you can or wish to resolve the defect by yourself, here is how you can do so;

- Fork this project
- Create a new local development branch for the given defect-fix
- Write your code / changes
- Create executable test-cases (prove that your changes are solid!)
- Commit and push your changes to your fork-repository
- Send a pull-request with your changes
- *Drink a [Beer](https://en.wikipedia.org/wiki/Beer) - you earned it* :)

As soon as I receive the pull-request (*and have time for it*), I will review your changes and merge them into this project. If not, I will inform you why I choose not to.

Acknowledgement
---------------

[](#acknowledgement)

- [Taylor Otwell](https://github.com/taylorotwell), for creating [Laravel](http://laravel.com) and especially the [Service Container](https://laravel.com/docs/5.4/container), that I'm using daily
- [Jeffrey Way](https://github.com/JeffreyWay), for creating [Laracasts](https://laracasts.com/) - a great place to learn new things... E.g. how to use the configuration repository

Versioning
----------

[](#versioning)

This package follows [Semantic Versioning 2.0.0](http://semver.org/)

License
-------

[](#license)

[BSD-3-Clause](http://spdx.org/licenses/BSD-3-Clause), Read the LICENSE file included in this package

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 98.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 ~99 days

Recently: every ~157 days

Total

12

Last Release

2767d ago

Major Versions

1.1.1 → 2.0.02016-08-27

2.1.0 → 3.0.02017-01-27

3.0.2 → 4.0.02017-10-14

4.0.0 → 5.0.02018-03-04

PHP version history (3 changes)1.0.0PHP &gt;=5.6.0

2.0.0PHP &gt;=5.6.4

4.0.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1523223?v=4)[Alin Eugen Deac](/maintainers/aedart)[@aedart](https://github.com/aedart)

---

Top Contributors

[![aedart](https://avatars.githubusercontent.com/u/1523223?v=4)](https://github.com/aedart "aedart (93 commits)")[![chrisbjr](https://avatars.githubusercontent.com/u/571279?v=4)](https://github.com/chrisbjr "chrisbjr (1 commits)")

---

Tags

configlaravelloaderparseconfigparserloader

### Embed Badge

![Health badge](/badges/aedart-config-loader/health.svg)

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

###  Alternatives

[laktak/hjson

JSON for Humans. A configuration file format with relaxed syntax, fewer mistakes and more comments.

86233.7k12](/packages/laktak-hjson)[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)[romanpitak/nginx-config-processor

Nginx configuration files processor.

7235.3k1](/packages/romanpitak-nginx-config-processor)[jakoch/nginx-conf

A Nginx Conf parser and generator.

111.5k](/packages/jakoch-nginx-conf)

PHPackages © 2026

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