https://github.com/linkorb/hiera-php
Hiera implemented in PHP
https://github.com/linkorb/hiera-php
Last synced: 3 months ago
JSON representation
Hiera implemented in PHP
- Host: GitHub
- URL: https://github.com/linkorb/hiera-php
- Owner: linkorb
- License: mit
- Created: 2015-03-30T07:44:03.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-03-30T08:35:16.000Z (about 11 years ago)
- Last Synced: 2024-04-04T07:21:28.546Z (about 2 years ago)
- Language: PHP
- Size: 133 KB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Hiera implemented in PHP
======
## What is Hiera?
According to the [Hiera website](http://docs.puppetlabs.com/hiera/):
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
```php
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!
## License
MIT (see [LICENSE.md](LICENSE.md))
## Brought to you by the LinkORB Engineering team

Check out our other projects at [linkorb.com/engineering](http://www.linkorb.com/engineering).
Btw, we're hiring!