Download the PHP package ama-team/yamligniter without Composer
On this page you can find all versions of the php package ama-team/yamligniter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ama-team/yamligniter
More information about ama-team/yamligniter
Files in ama-team/yamligniter
Package yamligniter
Short Description Simple tool to configure CodeIgniter 2/3 with YAML
License MIT
Informations about the package yamligniter
YamlIgniter
This repository contains a simple tool to boot CodeIgniter projects with YAML config.
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
Just the usual thing:
Usage
CodeIgniter takes it's config by letting user to fill some variables in user-maintained scripts. Let's exploit that:
You can now also use environment-based configuration files:
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
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:
Database method acts differently. The source config file should
represent database.php
structure:
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:
Testing
Testing is done via Codeception framework alongside with Allure Framework for reporting. Launching tests is easy:
To get full-blown reporting, install Allure commandline and use following command:
Contributing
Fork, fix, enhance, create pull request, ping maintainers if there's no reaction.