Laravel Auto Binder: Bind Interfaces to Implementations Automatically

0
50
laravel-auto-binding-featured.png


Laravel Auto Binder is a package by Michael Rubel that binds interfaces to implementations automatically. This package automatically binds interfaces to implementations in the Service Container, scanning the specified project folders. This helps avoid manually registering container bindings when the project needs to bind many interfaces to its implementations without any additional dependencies.

Given the following file path conventions, your implementations are automatically available in the service container:

1namespace AppServices;

2 

3use AppServicesInterfacesExampleInterface;

4 

5class ExampleService implements ExampleInterface

6{}

The package’s configuration gives you the option to change the convention of where to look for contracts and implementations. You have complete control over the type of bindings, interface naming conventions, and folders to scan.

You can learn more about this package, get full installation instructions, and view the source code on GitHub.



Source link

Leave a reply

Please enter your comment!
Please enter your name here