neoxygen / neo4j-neoclient

Simple PHP HttpClient for the Neo4j ReST API with Multi DB Support
MIT License
121 stars 138 forks source link

Explanation about the DI #1

Closed ikwattro closed 9 years ago

ikwattro commented 10 years ago

The lib uses DI, each command is passed the HttpClient in the injector. Also the DIC call the registerCommand method for each command defined in the library and soon for registering your own commands ( setter injection ). All this logic is done in the compiler passes.

Also, commands are declared as lazy services, meaning that at runtime it is a proxy class that is passed to the CommandManager, and the class is instantiated only when calling the command itself, so uncalled command classes will not be instantiated.