定制 linkorb/hiera-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

linkorb/hiera-php

Composer 安装命令:

composer require linkorb/hiera-php

包简介

A PHP implementation of Hiera

README 文档

README

What is Hiera?

According to the Hiera website:

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

Hiera uses a configurable hierarchy to enable "Cascading Configuration".

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

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.

Usage

hiera-php can be used both as a library, and as a console-tool

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

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

Contributions are very welcome!

License

MIT (see LICENSE.md)

Brought to you by the LinkORB Engineering team


Check out our other projects at linkorb.com/engineering.

Btw, we're hiring!

统计信息

  • 总下载量: 54
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-30