Slim\Container is hard to reuse by subclassing

Created on 17 Apr 2017  路  3Comments  路  Source: slimphp/Slim

Is it possible to decouple the registry of default service providers from Slim\Container?

There may be two options:

a) if $defaultSettings and registerDefaultServices() were not private but protected, I can subclass it and override them to reduce the impact.

b) extract core features to super class as, say, BaseContainer or something like that. It may has every features of Psr\Container\ContainerInterface.

Option a) is easier way, but sealing some feature by overriding sounds bad. Option b) may be the fundamental approach for reuse.

I just sent a pull request for option a). https://github.com/slimphp/Slim/pull/2202

Most helpful comment

FWiW, v4 will fix this properly by removing core's reliance on a DI container completely.

All 3 comments

FWiW, v4 will fix this properly by removing core's reliance on a DI container completely.

That sounds good and a little bit of worry. Besides this topic, I am interested on v4 architecture design. Is DI Container optional on v4? Or just removing those reliance? If latter, What is the alternative to supply those information to an app?

v4 will continue to support the DI container, but not need it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

codeguy picture codeguy  路  4Comments

jaklimoff picture jaklimoff  路  4Comments

snoopy72 picture snoopy72  路  4Comments

xymz picture xymz  路  5Comments

adambro picture adambro  路  3Comments