https://github.com/chubbyphp-legacy/chubbyphp-config
A simple config.
https://github.com/chubbyphp-legacy/chubbyphp-config
chubbyphp-container config extendable php pimple
Last synced: 3 months ago
JSON representation
A simple config.
- Host: GitHub
- URL: https://github.com/chubbyphp-legacy/chubbyphp-config
- Owner: chubbyphp-legacy
- License: mit
- Archived: true
- Created: 2018-08-20T19:18:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-26T06:22:32.000Z (over 5 years ago)
- Last Synced: 2025-11-27T14:48:56.860Z (5 months ago)
- Topics: chubbyphp-container, config, extendable, php, pimple
- Language: PHP
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chubbyphp-config
[](https://travis-ci.org/chubbyphp/chubbyphp-config)
[](https://coveralls.io/github/chubbyphp/chubbyphp-config?branch=master)
[](https://packagist.org/packages/chubbyphp/chubbyphp-config)
[](https://packagist.org/packages/chubbyphp/chubbyphp-config)
[](https://packagist.org/packages/chubbyphp/chubbyphp-config)
[](https://packagist.org/packages/chubbyphp/chubbyphp-config)
## Description
A simple config.
DEPRECATED: I suggest to use [chubbyphp-laminas-config][3] with or without config stuff from [laminas][4].
## Requirements
* php: ^7.2
## Suggest
* chubbyphp/chubbyphp-container: ^1.0
* pimple/pimple: ^3.2.3
* symfony/console: ^2.8.50|^3.4.26|^4.2.7|^5.0
## Installation
Through [Composer](http://getcomposer.org) as [chubbyphp/chubbyphp-config][1].
```bash
composer require chubbyphp/chubbyphp-config "^2.1"
```
## Usage
### Command
* [CleanDirectoriesCommand][2]
### Bootstrap
#### ServiceFactory (chubbyphp/chubbyphp-container)
```php
factories((new ConfigServiceFactory((new ConfigProvider([
new DevConfig(__DIR__.'/..'),
new ProdConfig(__DIR__.'/..'),
]))->get($env)))());
```
#### ServiceProvider (pimple/pimple)
```php
register(new ConfigServiceProvider(
(new ConfigProvider([
new DevConfig(__DIR__.'/..'),
new ProdConfig(__DIR__.'/..'),
]))->get($env)
));
```
### Config
```php
rootDir = $rootDir;
}
/**
* @return array
*/
public function getConfig(): array
{
return [
'env' => $this->getEnv(),
'rootDir' => $this->rootDir
];
}
/**
* @return array
*/
public function getDirectories(): array
{
$environment = $this->getEnv();
return [
'cache' => $this->rootDir . '/var/cache/' . $environment,
'logs' => $this->rootDir . '/var/logs/' . $environment,
];
}
public function getEnv(): string
{
return 'dev';
}
}
```
## Copyright
Dominik Zogg 2020
[1]: https://packagist.org/packages/chubbyphp/chubbyphp-config
[2]: doc/Command/CleanDirectoriesCommand.md
[3]: https://packagist.org/packages/chubbyphp/chubbyphp-laminas-config
[4]: https://github.com/laminas?q=config&type=&language=php