OpenImporter / openimporter

Development workspace for the open Importer engine.
BSD 3-Clause "New" or "Revised" License
20 stars 14 forks source link

Dependency injection container #62

Open emanuele45 opened 9 years ago

emanuele45 commented 9 years ago

I have been playing with a DIC in the last few days and the results are: https://github.com/emanuele45/openimporter/tree/dic and: https://github.com/emanuele45/openimporter/tree/pimple The first branch uses the Symfony DependencyInjection component, while the second Pimple.

The basic difference is that with Symfony it is possible to set up the container with a configuration file (service.yml), while with Pimple the container is set up inside import.php, I an article on how to make Pimple use a configuration file, but it looks like more work. To me the second (Pimple) looks a bit ugly... I'd prefer the first, even though it requires to "learn" the syntax to set up few "odd" things (like the @=service('configurator').lang_dir), but for the rest is quite straightforward and seems to work well.

Opinions? Would OI benefit at all from a DIC? Would you prefer Symfony or Pimple or another one? Any other comment?

joshuaadickerson commented 9 years ago

On the backend, Symfony is doing pretty much exactly what you see Pimple doing to have a YAML file loader. I like using the PHP bootstrap file because it makes more sense to me.