skpr/config

Reads skipper configuration files.

3.0.2 2022-12-15 07:08 UTC

This package is auto-updated.

Last update: 2024-07-15 11:04:01 UTC


README

CircleCI

A simple utility for reading skpr config from a directory, and populating environment variables in PHP applications.

The default skpr config directory is /etc/skpr

Usage

Loading config

$config = SkprConfig::create()->load();
$config->get('foo.bar');

Setting environment variables

You can optionally set environment variables from Skpr config.

$config = SkprConfig::create()->load();
$config->putAllEnvs();

Keys will be converted to uppercase, and dots are converted to underscores. For example:

getenv('FOO_BAR')

You can also provide a list of config keys, to avoid adding all config as environment variables:

$config = SkprConfig::create()->load();
$config->putEnvs(['my.key1', 'my.key2']);

Testing

Run tests using the following:

bin/phpunit

Code Standards

Run code style checks with the following:

bin/phpcs