https://github.com/f3ath/pimple-config
Simple multi-environment configuration for Pimple with secret storage support
https://github.com/f3ath/pimple-config
configuration php pimple
Last synced: 4 months ago
JSON representation
Simple multi-environment configuration for Pimple with secret storage support
- Host: GitHub
- URL: https://github.com/f3ath/pimple-config
- Owner: f3ath
- License: mit
- Created: 2017-03-01T15:41:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-07T10:10:12.000Z (over 8 years ago)
- Last Synced: 2025-01-01T19:28:00.927Z (5 months ago)
- Topics: configuration, php, pimple
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PimpleConfig is a simple multi-environment configuration for Pimple/Silex with secret storage support
## Install
```
composer install f3ath/pimple-config
```
## Configuration structure
### Environment-specific config
A config is a file named `.php` which returns an array:
```php
true,
'foo' => [
'bar' => 'baz'
]
];
```
To reduce duplication, here is some sort of "inheritance":
```php
false,
]);
```
### Secret config
It is a healthy practice to store sensitive data like passwords outside of the repository. The simplest implementation
would be to store such files right on the server. These files may be edited directly, so they should not be php scripts,
since it's easy to accidentally remove the ` '/etc/my_application/secret.json',
'debug' => false,
]);
```
### Services
Pimple services are configured in the set of files in the `services` directory. In your configuration you define:
```php
[
'application' => __DIR__ . '/services/application.php',
'storage' => __DIR__ . '/services/storage.php',
'controllers' => __DIR__ . '/services/controllers.php',
],
];
```
A service config is a php script which returns a special function:
```php
register(new \F3\PimpleConfig\Config($config_root, $env_name));
```For more examples see the [unit test](test/ConfigTest.php).
### Contribution
Please do!