PHPackages                             ama-team/yamligniter - 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. ama-team/yamligniter

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

ama-team/yamligniter
====================

Simple tool to configure CodeIgniter 2/3 with YAML

0.1.1(9y ago)1105MITPHP

Since Mar 17Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ama-team/yamligniter)[ Packagist](https://packagist.org/packages/ama-team/yamligniter)[ RSS](/packages/ama-team-yamligniter/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

YamlIgniter
===========

[](#yamligniter)

This repository contains a simple tool to boot CodeIgniter projects with YAML config.

Motivation
----------

[](#motivation)

There are two types of configuration: declarative and executed (so it's basically a big function that somehow provides configuration to application, either via return or side-effects). While executed configuration (which is used by CodeIgniter) gives infinite freedom to end user (you can compute values on-the-fly), it lacks the ability of easy machine processing that declarative configuration has, and limits your freedom in automation. Declarative configuration, such as YAML files, is static, but can be easily created by a script using any language, and gives huge benefit for automating things like continuous deployments and automated environment creation (for feature branches, for example).

Because we had some troubles deploying our CodeIgniter projects from scratch, i decided to help CodeIgniter to switch to YAML for configuration.

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

[](#installation)

Just the usual thing:

```
composer require ama-team/yamligniter

```

Usage
-----

[](#usage)

CodeIgniter takes it's config by letting user to fill some variables in user-maintained scripts. Let's exploit that:

```
// application/config/config.php

extract(AmaTeam\YamlIgniter::config(__DIR__ . '/config.yml'));
```

```
// application/config/database.php

extract(AmaTeam\YamlIgniter::database(__DIR__ . '/database.yml');
```

You can now also use environment-based configuration files:

```
// application/config/database.php

extract(AmaTeam\YamlIgniter::database(__DIR__ . '/' . ENVIRONMENT . '/database.yml');
```

YamlIgniter will take your configuration, fill the missing gaps with default values, and then return full config to you for future processing or extraction into local variables.

Formals
-------

[](#formals)

Static methods `YamlIgniter::database()` and `YamlIgniter::config()`are just wrappers around similar non-static methods: they've been implemented solely for simplified access. Their implementation differ a little - `::config()` simply reads YAML file, fills all gaps with default values and returns in an array under `config` key:

```
# config.yml
base_url: https://project.dev/

# results in
config:
  base_url: 'http://project.dev/'
  index_page: 'index.php'
  uri_protocol: 'REQUEST_URI'
  ...
```

Database method acts differently. The source config file should represent `database.php` structure:

```
# database.yml
query_builder: true
db:
  default:
    username: johnny
    password: rubber
    database: project
    failover:
      - username: johnny
        password: rubber
        database: project
        hostname: failover-host.intranet
```

YamlIgniter then takes this input and transforms as described:

- Merges root context with defaults for framework version (in current example, `active_group: default` would be added to config)
- Iterates over all entries of `db`, merging every entry with default database context
- Iterates over all entries of `db.*.failover`, merging every entry with default database context

So above example would result in:

```
query_builder: true
active_group: default
db:
  default:
    dsn: ''
    hostname: localhost
    username: johnny
    password: rubber
    database: project
    dbdriver: mysqli
    ...
    failover:
      - dsn: ''
        username: johnny
        password: rubber
        database: project
        hostname: failover-host.intranet
        dbdriver: mysqli
        ...
```

Testing
-------

[](#testing)

Testing is done via [Codeception](http://codeception.com/) framework alongside with [Allure Framework](http://allure.qatools.ru/) for reporting. Launching tests is easy:

```
bin/codecept run
```

To get full-blown reporting, install Allure commandline and use following command:

```
composer run-script test:full
```

Contributing
------------

[](#contributing)

Fork, fix, enhance, create pull request, ping maintainers if there's no reaction.

Self-esteem badge cellar
------------------------

[](#self-esteem-badge-cellar)

### Master branch

[](#master-branch)

[![CircleCI/master](https://camo.githubusercontent.com/0cbfc351c18f5878431b9b5df5b8fbdb64bb477d0fd499e70fffe635ebd5b4ff/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f70726f6a6563742f6769746875622f616d612d7465616d2f79616d6c69676e697465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://circleci.com/gh/ama-team/yamligniter/tree/master)[![Coveralls/master](https://camo.githubusercontent.com/9aa040d7f14907e843c77be7868ea9a1e4d1540855e625b2ea4e2f221d8bd9bf/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f616d612d7465616d2f79616d6c69676e697465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/ama-team/yamligniter?branch=master)[![CodeClimate](https://camo.githubusercontent.com/5c52fdb50efbd36c8967b6f8bd51dfe0ab87c2853850037c5a193f7979f0cbe9/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6769746875622f616d612d7465616d2f79616d6c69676e697465722e7376673f7374796c653d666c61742d737175617265)](https://codeclimate.com/github/ama-team/yamligniter)[![Packagist](https://camo.githubusercontent.com/3a1885b9208eb8a2524dc512a42afc76d265e03953cf9227204f9de2ad65b5de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616d612d7465616d2f79616d6c69676e697465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ama-team/yamligniter)[![Packagist](https://camo.githubusercontent.com/161a8e007a0d584e0c8599ef67735c25860374f979f73dd953fe58935404505b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d612d7465616d2f79616d6c69676e697465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ama-team/yamligniter)

### Dev branch

[](#dev-branch)

[![CircleCI/dev](https://camo.githubusercontent.com/9089b1e55e136cb126e5164bf533f5757acd11caa084b6772a3d0b1a58178b79/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f70726f6a6563742f6769746875622f616d612d7465616d2f79616d6c69676e697465722f6465762e7376673f7374796c653d666c61742d737175617265)](https://circleci.com/gh/ama-team/yamligniter/tree/dev)[![Coveralls/dev](https://camo.githubusercontent.com/09b206717ec50971c2b873da90edaacc9ff6ff01dce45f6fcf2c9db011f12263/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f616d612d7465616d2f79616d6c69676e697465722f6465762e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/ama-team/yamligniter?branch=dev)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

2

Last Release

3392d ago

### Community

Maintainers

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

---

Top Contributors

[![etki](https://avatars.githubusercontent.com/u/1909762?v=4)](https://github.com/etki "etki (9 commits)")

---

Tags

codeigniter

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/ama-team-yamligniter/health.svg)

```
[![Health](https://phpackages.com/badges/ama-team-yamligniter/health.svg)](https://phpackages.com/packages/ama-team-yamligniter)
```

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1175.2k](/packages/rcsofttech-audit-trail-bundle)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49517.1k](/packages/blackfire-player)[altis/local-server

Local Server module for Altis

18217.0k2](/packages/altis-local-server)

PHPackages © 2026

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