Hiraeth’s flexibility and power comes from its dependency injection system which relies on the
Hiraeth\Broker, a PSR-11 compatible version of the auryn dependency injector. Put simply, dependency injection is a way to instantiate classes into objects such that the additional objects on which that class relies (depends) are automatically created and passed to its
Dependency injection is not magic, it relies on objects being instantiated by the dependency injector itself and it requires good object oriented design with strong typehinting to know what it needs to inject. Hiraeth packages go to great efforts to ensure that most object instantiation occurs in this manner. If you’re adding a class to a configuration file, chances are it is going to be instantiated by the dependency injector.
hiraeth/bootstrap, all of the following will be dependency injected:
Dependency injection is recursive. As such, the dependency injector will try to construct any class/interface typehinted dependencies for your dependencies. In some cases, the dependency injector doesn’t have the information required to know what to inject. Hiraeth allows you to define how these classes should be constructed by registering delegates and providers.