Download the PHP package michael-rubel/laravel-auto-binder without Composer

On this page you can find all versions of the php package michael-rubel/laravel-auto-binder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-auto-binder

Automated container bindings

Laravel Auto-Binder

Latest Version on Packagist Total Downloads Code Quality Code Coverage GitHub Tests Action Status PHPStan

This package adds the possibility to bind interfaces to concrete classes in the Service Container by scanning the specified project folders. This helps avoid manually registering container bindings when the project needs to bind a lot of interfaces to its implementations.


The package requires PHP 8 or higher and Laravel 9 or higher.

StandWithUkraine

SWUbanner

Installation

Install the package using composer:

Usage

Define in your ServiceProvider:

Assuming you have your services in the App\Services and its interfaces in the App\Services\Interfaces, the package will register binding for each pair of class and interface:

Customization

If you need to customize the base path or namespace, you can use following methods:

This configuration would look for classes in the app/Domain/Services folder, use App\\Domain namespace and apply interfaces from App\\Domain\\Interfaces namespace with ClassNameInterface naming convention.

If you need to change the naming convention of your interfaces, you can specify the namespace and name you prefer:

This configuration scans the app/Services folder with App\\Services namespace, App\\Services\\Contracts interface namespace and ClassNameContract interface naming convention.

Excluding subfolders from scan

You might as well exclude subdirectories from the scan of the root directory:

Dependency injection

If you want to inject dependencies to your services while scanning, you can use when method:

Passing a concrete class as well as an interface is possible, but keep in mind interfaces have a higher priority when applying dependencies.

Scanning multiple folders at once

If you pass multiple folders, the from method will return an instance of Illuminate/Support/Collection. Assuming that, you can loop over your AutoBinder class instances with access to internal properties.

For example:

Caching

The package will cache your bindings to avoid redundant folder scans during the application bootstrapping process.

If you want cache to be disabled, you may use withoutCaching method on the AutoBinder instance, e.g.:

You can as well clear the cache for specific folder by using an Artisan command:

Note that for the command to work you should use the folder name you passed to the AutoBinder instance in the from method. Also, the cache will be ignored in the local environment.

Testing

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-auto-binder with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/contracts Version ^10.0|^11.0
spatie/laravel-package-tools Version ^1.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package michael-rubel/laravel-auto-binder contains the following files

Loading the files please wait ....