Auto-Discovery feature in Laravel 5.5 is pretty cool. It makes adding packages a little bit easier(or removing them). We are going to use anhskohbo no no-captcha package as the example on how to use it.
Now we need to use the following command to add the example package to the composer file.
composer require anhskohbo/no-captcha
The old Way of doing it
Before this package is working we need to edit the following file app/config/app.php and add the below:
The ServiceProvider to the providers array :
'NoCaptcha' => Anhskohbo\NoCaptcha\Facades\NoCaptcha::class,
The class alias to the aliases array :
‘NoCaptcha’ => Anhskohbo\NoCaptcha\Facades\NoCaptcha::class,
Publish the config file
php artisan vendor:publish –provider=”Anhskohbo\NoCaptcha\NoCaptchaServiceProvider”
Using The Auto-Discovery feature
Now with this feature we don’t need to mess about with any other file other than the composer, with Laravel 5.5, in the composer file you will see “extra” half way down the file and we add the following to fully setup the example package.
And that’s it, the package will work now.