An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# chubbyphp-config

[![Build Status](https://api.travis-ci.org/chubbyphp/chubbyphp-config.png?branch=master)](https://travis-ci.org/chubbyphp/chubbyphp-config)
[![Coverage Status](https://coveralls.io/repos/github/chubbyphp/chubbyphp-config/badge.svg?branch=master)](https://coveralls.io/github/chubbyphp/chubbyphp-config?branch=master)
[![Latest Stable Version](https://poser.pugx.org/chubbyphp/chubbyphp-config/v/stable.png)](https://packagist.org/packages/chubbyphp/chubbyphp-config)
[![Total Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-config/downloads.png)](https://packagist.org/packages/chubbyphp/chubbyphp-config)
[![Monthly Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-config/d/monthly)](https://packagist.org/packages/chubbyphp/chubbyphp-config)
[![Daily Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-config/d/daily)](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