2017 © Pedro Peláez
 

library hiera-php

A PHP implementation of Hiera

image

linkorb/hiera-php

A PHP implementation of Hiera

  • Monday, March 30, 2015
  • by joostfaassen
  • Repository
  • 3 Watchers
  • 3 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Hiera implemented in PHP

What is Hiera?

According to the Hiera website:, (*1)

Hiera is a key/value lookup tool for configuration data.

Hiera uses a configurable hierarchy to enable "Cascading Configuration"., (*2)

It's great for infrastructure configuration (which is why it's used in Puppet), but it also applies to multi-tenancy applications., (*3)

Hiera-PHP tries to be as much of a direct port as possible, maintaining support for original configuration files, and even internal classnames and interfaces., (*4)

Usage

hiera-php can be used both as a library, and as a console-tool, (*5)

Library

use Hiera\Hiera;
use Hiera\Scope;
use Hiera\ConfigLoader\YamlConfigLoader;

$scope = new Scope();
$scope->setVariable('::environment', 'production');
$scope->setVariable('::clientcert', 'web01.dc1.example.webx');
$scope->setVariable('::country', 'nl');
$hiera = new Hiera();
$loader = new YamlConfigLoader();
$loader->load($hiera, $path_to_hiera_yaml_file);

$key = 'some_configuration_key';
$answer = $hiera->lookup($key, '#default#', $scope);

Console tool

vendor/bin/hiera-php hiera:lookup some_configuration_key

Features

  • [x] Supports loading original hiera.yaml files
  • [x] Supports pluggable backends
  • [x] Yaml backend included (supporting original configuration yaml files)
  • [x] Command line utility to perform lookups
  • [x] Embeddable as a library
  • [ ] Json backend
  • [ ] Database (PDO, Redis, etc) backends
  • [ ] Memcached backend
  • [ ] Array merge strategies

Contributions are very welcome!, (*6)

License

MIT (see LICENSE.md), (*7)

Brought to you by the LinkORB Engineering team


Check out our other projects at linkorb.com/engineering., (*8)

Btw, we're hiring!, (*9)

The Versions

30/03 2015

dev-master

9999999-dev

A PHP implementation of Hiera

  Sources   Download

MIT

The Requires

 

config feature flags hiera hierarchical database