mjaschen/collmex

Register instances in Laravel ServiceProvider with interface names

Closed this issue · 1 comments

For better support of automatic service resolving we should bind instances with their respective interface names:

$this->app->singleton(
            'collmex.client',
            static function () {
                return new CurlClient(...);
            }
        );

should become

$this->app->singleton(
            MarcusJaschen\Collmex\Client\ClientInterface::class,
            static function () {
                return new CurlClient(...);
            }
        );

The same applies to Request and MultiRequest.

As this is a breaking change, the old behaviour should be marked as deprecated in the next major release and removed in the major release after that.

Implemented in 3.0.0 (without breaking BC).