PHP-DI Symfony Bridge

Use PHP-DI containers and packages using it in your Symfony application.


This package provides integration for PHP-DI with Symfony. PHP-DI is a dependency injection container for PHP. This bridge works as Symfony Bundle to integrate PHP-DI, into the Symfony Service Container, as factory for entries defined in PHP-DI.

Unlike the official bridge, this bridge does not require to use a custom version of Symfony's Kernel, neither a custom version of Symfony's services container. During the compilation of the Symfony services container, all entries in PHP-DI will be referenced into Symfony's Services Container.

The bridge will also implements the PSR Container interface (PSR-11) to act as an interface with Symfony Service Container in PHP-DI factory.

The bridge will also automatically manage the management of the parameters, managed differently by Symfony.

PHP DI Logo

Features


Bundle

Use the Bridge like any Symfony Bundle

Userfriendly

No require customization of Symfony

Transparent

Each container can communicate with each other

Universal

Allow use of universal package with Symfony

GitHub


Fork the project on GitHub

It is open source! Hosted, developed, and maintained on GitHub.


View GitHub Project

Patreon


Support this project on Patreon

This project is free and will remain free, but its development is not. If you like it and help us maintain it and evolve it, don't hesitate to support us on Patreon.


Support it

Example



<?php

// Add to you `bundles.php` file
return [
//..
Teknoo\DI\SymfonyBridge\DIBridgeBundle::class => ['all' => true],
//..
];

// Create the file `di_bridge.yaml` in your config folder and put in

di_bridge:
definitions:
-
'list of PHP-DI definitions file, you can use Symfony joker like %kernel.project_dir%'
#example
- '%kernel.project_dir%/vendor/editor_name/package_name/src/di.php'
- '%kernel.project_dir%/config/di.php'
import:
#To make alias from SF entries into PHPDI
My\Class\Name: 'symfony.contaner.entry.name'