AcclimateContainer / acclimate-container

Adapters for PHP framework containers to an interoperable interface
MIT License
220 stars 16 forks source link

make() method? #50

Open lougreenwood opened 6 years ago

lougreenwood commented 6 years ago

Hey, thanks for a great tool! I'm trying to integrate PHP DI and larval containers.

This is specifically because Laravel's container has some funky behaviour and from my usage, it seems inferior to PHP DI.

I understand that a make method is outside of the scope of PSR11, but seems like a useful addition to Acclimate?

http://php-di.org/doc/container.html#make https://laravel.com/docs/5.5/container#resolving

lougreenwood commented 6 years ago

Alternatively, is there any way I can get at the public methods of a container which is within the composite? It doesn't seem possible because $my_composite->containers is protected.

As a workaround to a proper make() method, I could do something like:

$my_composite->containers[0]->make( someClass:class [
    'param' => 'value',
    'other_param' => 'other value'
]);