Laravel Auto Binder: Bind Interfaces to Implementations Automatically
Published on by Paul Redmond
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:
namespace App\Services; use App\Services\Interfaces\ExampleInterface; class ExampleService implements ExampleInterface{}
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.