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

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

asgard/config
=============

v0.3.1(10y ago)01.2k2MITPHPPHP &gt;=5.5.9

Since Sep 9Pushed 8y agoCompare

[ Source](https://github.com/asgardphp/config)[ Packagist](https://packagist.org/packages/asgard/config)[ RSS](/packages/asgard-config/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (2)

\#Config

[![Build Status](https://camo.githubusercontent.com/6ff43f1b501b6bbc4730b7545f12718027afd4f6feedb56279843c45f95034d1/68747470733a2f2f7472617669732d63692e6f72672f6173676172647068702f636f6e6669672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/asgardphp/config)

The Config package helps you manage the configuration of your application.

- [Installation](#installation)
- [Usage in the Asgard Framework](#usage-asgard)
- [Usage outside the Asgard Framework](#usage-outside)
- [methods](#methods)
- [structure](#structure)
- [Commands](#commands)

\##Installation **If you are working on an Asgard project you don't need to install this library as it is already part of the standard libraries.**

```
composer require asgard/config 0.*

```

\##Usage in the Asgard Framework

```
$config = $container['config'];

```

The [container](docs/container) is often accessible as a method parameter or through a [ContainerAware](docs/container#containeraware) object. You can also use the [singleton](docs/container#usage-outside) but it is not recommended.

\##Usage outside the Asgard Framework

```
$config = new \Asgard\Config\Config;

```

\##Methods

Config inherits [\\Asgard\\Common\\Bag](docs/bag) to access its data.

Besides, you can load a configuration with:

```
$config->loadFile('file.yml');

```

Or a whole directory:

```
$config->loadDir('config/');

```

This will load files that in the directory.

**Local files**

If you want to add configuration specific to your local setup, name the file as such:

```
config.local.yml

```

The file will be loaded after others, and is ignored by default by the Asgard application .gitignore file.

**Environment files**

If you want to make configuration files specific to environments, name them as such:

```
config_[env].yml

```

With \[env\] being the name of the environment.

Calling:

```
$config->loadDir('config/', 'prod');

```

Will load default configuration files, plus all \*\_prod.yml files, while ignoring files like \*\_dev.yml

\##Configuration file structure

A configuration file, like config.yml contains an array of parameters in YAML format:

```
database:
	host: localhost
	user: root
	password:
	database: asgard

```

Each key can be acessed like:

```
$config->get('database.user');
#or
$config['database.user'];
#or
$config['database']['user'];

```

\##Commands

\###Init

Initialize the configuration files.

Usage:

```
php console config:init

```

\###Contributing

Please submit all issues and pull requests to the [asgardphp/asgard](http://github.com/asgardphp/asgard) repository.

### License

[](#license)

The Asgard framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

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

Total

4

Last Release

3657d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.4.0

v0.3.0PHP &gt;=5.5.9

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/352850?v=4)[leyou](/maintainers/leyou)[@leyou](https://github.com/leyou)

---

Top Contributors

[![h0gar](https://avatars.githubusercontent.com/u/439138?v=4)](https://github.com/h0gar "h0gar (53 commits)")

### Embed Badge

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

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

###  Alternatives

[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)

PHPackages © 2026

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