Dependency injection container creation by config, inspired by mezzio-config.
- node: 18
- @chubbyts/chubbyts-dic: ^1.3.1
- @chubbyts/chubbyts-dic-types: ^1.3.1
Through NPM as @chubbyts/chubbyts-dic-config.
npm i @chubbyts/chubbyts-dic-config@^1.3.1
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();
2025 Dominik Zogg