Download the PHP package rumur/autowire without Composer
On this page you can find all versions of the php package rumur/autowire. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rumur/autowire
More information about rumur/autowire
Files in rumur/autowire
Package autowire
Short Description Simple PHP autowiring functionality.
License MIT
Homepage https://github.com/rumur/autowire
Informations about the package autowire
Simple PHP Autowiring
Package Installation
How to use it?
It's actually pretty simple. A good starting point is to create an instance of Autowire
class.
`
Register Singletons
Autowire
allows you to register any instance/variable as a singleton, so you'll be able always get the same outcome,
when one of your classes or functions would need such dependency.
For an instance, let's imagine that you need to inject wpdb
class in some repositories of yours.
For this, we would need to register wbdb
as a singleton and just pass one of your repositories into the Autowire::make
method and the rest Autowire
does for you.
`
Binding
In case you need to bind a specific interface with its implementation Autowire
gets you covered.
NOTE. In some case you don't have to bind
all available classes to Autowire
in order to be able to resolve them as a dependency, e.g. OrderController
below never been bound to Autowire
but it still can make
it for you automatically.
Autowire callables
In case you need to resolve dependencies either for a method or
any other callable instance, Autowire::call
comes to rescue.
License
This package is licensed under the MIT License - see the LICENSE.md file for details.