skpr / config
Reads skipper configuration files.
Installs: 127 305
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: ^7.2||^8.0
- ext-json: *
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.1
- drupal/coder: ~8.3.12
- phpcompatibility/php-compatibility: ^9.3
- phpunit/phpunit: ^8.5||^9.5
This package is auto-updated.
Last update: 2024-10-18 07:46:39 UTC
README
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