https://github.com/ofcold/component-config
Manage Ofcold configuration by persistent storage.
https://github.com/ofcold/component-config
Last synced: 4 months ago
JSON representation
Manage Ofcold configuration by persistent storage.
- Host: GitHub
- URL: https://github.com/ofcold/component-config
- Owner: ofcold
- Created: 2021-06-23T07:03:59.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-09T08:55:02.000Z (over 4 years ago)
- Last Synced: 2025-08-01T17:03:07.258Z (8 months ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Promise Component Config
> Manage Promise configuration by persistent storage.
## Installing
```
composer require ofcold/component-config
```
## Useing
```php
$config = new Ofcold\Component\Config\Repository
// Set initial configuration items
$config->addNamespace('your-config-path');
// Add a namespace to configuration.
$config->addNamespace(__DIR__ '/your-path/config', 'user');
// Get a config item.
$config->get('foo');
// Get a namespace config item.
$config->get('user::foo.bar');
```
## Api
| Method | Description |
| :-----| :--------- |
| addNamespace(string $directory, ?string $namespace = null): void | Add a namespace to configuration. |
| has($key): bool | Determine if the given configuration value exists. |
| get($key, $default = null) |Get the specified configuration value. |
| getMany(array $keys): array | Get many configuration values. |
| set($key, $value = null): void | Set a given configuration value. |
| prepend($key, $value): void | Prepend a value onto an array configuration value. |
| push($key, $value): void | Push a value onto an array configuration value. |
| all(): array | Get all of the configuration items for the application.. |