@chubbyts/chubbyts-dic-config
Version:
Dependency injection container creation by config, inspired by laminas-config.
68 lines (51 loc) • 4.04 kB
Markdown
# chubbyts-dic-config
[](https://github.com/chubbyts/chubbyts-dic-config/actions?query=workflow%3ACI)
[](https://coveralls.io/github/chubbyts/chubbyts-dic-config?branch=master)
[](https://dashboard.stryker-mutator.io/reports/github.com/chubbyts/chubbyts-dic-config/master)
[](https://www.npmjs.com/package/@chubbyts/chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-dic-config)
## Description
Dependency injection container creation by config, inspired by [mezzio-config][2].
## Requirements
* node: 18
* [@chubbyts/chubbyts-dic][3]: ^1.3.1
* [@chubbyts/chubbyts-dic-types][4]: ^1.3.1
## Installation
Through [NPM](https://www.npmjs.com) as [@chubbyts/chubbyts-dic-config][1].
```ts
npm i @chubbyts/chubbyts-dic-config@^1.3.1
```
## Usage
```ts
import {
createContainerByConfigFactory,
ConfigFactory,
ConfigDelegator,
} from '@chubbyts/chubbyts-dic-config/dist/dic-config';
const containerByConfigFactory = createContainerByConfigFactory({
dependencies: {
services: new Map<string, any>(),
factories: new Map<string, ConfigFactory>(),
aliases: new Map<string, string>(),
delegators: new Map<string, Array<ConfigDelegator>>(),
},
// ... other configuration
});
const container = containerByConfigFactory();
```
## Copyright
2025 Dominik Zogg
[1]: https://www.npmjs.com/package/@chubbyts/chubbyts-dic-config
[2]: https://docs.mezzio.dev/mezzio/v3/features/container/config/
[3]: https://www.npmjs.com/package/@chubbyts/chubbyts-dic
[4]: https://www.npmjs.com/package/@chubbyts/chubbyts-dic-types