visma/php-di-bootstrapper

PHP-DI bootstrapper helpers

Maintainers

Package info

bitbucket.org/vismadc/php-di-bootstrapper

Issues

pkg:composer/visma/php-di-bootstrapper

Statistics

Installs: 147

Dependents: 0

Suggesters: 0

0.1.0 2020-01-30 12:38 UTC

This package is auto-updated.

Last update: 2026-02-28 02:22:56 UTC


README

Usage

Make an empty container (not very useful):

$bootstrap = new \Visma\PhpDiBootstrapper\Bootstrap();

$container = $bootstrap->create();

Usage with files

Load all files in the provided directory recusively as definitions, sorted by name

$bootstrap = new \Visma\PhpDiBootstrapper\Bootstrap();
$bootstrap->addDefinitionsFromDirectory(__DIR__ . '/src/definitions/');

$container = $bootstrap->create();

Usage with files and container compilation

Load all files in the provided directory recusively as definitions, sorted by name, only reading the files if the container is not already compiled

$bootstrap = new \Visma\PhpDiBootstrapper\Bootstrap();
$bootstrap->enableCompilation(__DIR__ . '/generated/container/');
$bootstrap->addDefinitionsFromDirectory(__DIR__ . '/src/definitions/');

$container = $bootstrap->create();