Questions tagged [php-di]

PHP-DI is a simple to use dependency injection container for PHP. It is practical, powerful, and framework-agnostic.

PHP-DI is a simple to use dependency injection container for PHP. It is practical, powerful, and framework-agnostic.

See more:

101 questions
0
votes
1 answer

PHP-DI does not inject the required class

I am using php-di in according to do dependency injection. The requests first arrive in the route.php file which configures php-di (for example to use AccountService when IAccountService is required) and then the container is asked to create…
ConductedClever
  • 4,175
  • 2
  • 35
  • 69
0
votes
3 answers

Partial dependency injection

In a MVC context, I have a controller that depends on a service, the service in turn depends on a data_source (in the specific case, a client to fetch data from a third-party API). In order to instantiate the service with a mock data_source when…
Cec
  • 1,726
  • 3
  • 18
  • 31
0
votes
1 answer

Pimcore and Dependency Injection

I want to use Dependency Injection in Pimcore. Luckily this is possible out of the box since Pimcore 4.x. But I must admit that I can't get it to work. I read those sites: DI, DI, DI as well as the documentation of php-di since Pimcore is using…
user3180943
  • 181
  • 1
  • 2
  • 17
0
votes
1 answer

Trouble injecting defined parameters into constructor using PHP-DI

This may seen rudimentary but I cant seem to directly inject any parameters into my class constructor without using annotations. Below is definition made and the class called $shell->set('root','[Root Definition Here]'); …
Stanley Ngumo
  • 4,089
  • 8
  • 44
  • 64
0
votes
1 answer

How to get the Twig object out of the container?

I'm using Slim Framework 3 with PHP-DI/Slim-Bridge. This is my container: $builder->addDefinitions([ 'settings.displayErrorDetails' => true, 'router' => get(Router::class), Twig::class =>…
Brent
  • 21
  • 1
  • 6
0
votes
1 answer

Using PHP-DI to inject variables into class methods automatically

I have been using PHP-DI and i wanted to enquire if there is a way to inject variables into various class methods automatically ie using autowiring. Thanks
Stanley Ngumo
  • 4,089
  • 8
  • 44
  • 64
0
votes
3 answers

PHP-DI is not working in integration with ZendFramework2

Could you please give a hint why PHP-DI integration with Zend Framework 2 is not working for me (reproduced with Apache/2.4.9 (Win64) PHP/5.5.12 and Apache/2.2.22 (Win32) PHP/5.3.13). composer.json: { "require": { "php": ">=5.3.3", …
Maksim
  • 1,231
  • 1
  • 15
  • 25
0
votes
1 answer

How to set PHP-DI definition to PHPActiveRecord Connection?

I'm a beginner about Dependency Injection and I'm using the following tools into my PHP 5.5.9 (under Apache2 and MySql) project: PHP-DI: "4.2.*@dev" - (http://php-di.org) to manage DI(C); PHPActiveRecord: "dev-master" -…
0
votes
1 answer

JMS DIExtraBundle / Annotations beyond Symfony Applications

I am currently developing a symfony application in which I want to have loose coupling of the business logic and the framework. I don't want to depend on the whole symfony framework and may be able exchange the framework later (and run my business…
Markus
  • 333
  • 4
  • 11
-1
votes
1 answer

Dependency Injection via setter method

Have an issue with dependency injection in PHP that I can't seem to find the answer to. Ok, quick PHP class:
Envrin
  • 19
  • 1
-3
votes
1 answer

PHP-DI using previously defined class

I am trying to improve my PHP-DI config, and now I stuck. I want to reuse an already defined class for another class. entityManager class should come from Database->getEntityManager Here is a part of my di config file: return [ 'database.user' …
vaso123
  • 12,347
  • 4
  • 34
  • 64
1 2 3 4 5 6
7