Remove pragmarx/tracker
package from laravel project by the following composer command
composer remove pragmarx/tracker
It’s remove successfully but the below error shown. Even though composer update
the error not fix.
Illuminate\Contracts\Container\BindingResolutionException
Target class [PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker] does not exist.
How can I fix this error ? and which method to follow to completely remove any unused packages from laravel?
>Solution :
From the documentation on the repo:
Installing
Require the tracker package by executing the following command in your command line:
composer require pragmarx/tracker
Add the service provider to your
app/config/app.php
:PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class,
Add the alias to the facade on your
app/config/app.php
:'Tracker' => 'PragmaRX\Tracker\Vendor\Laravel\Facade',
Publish tracker configuration:
Laravel 4
php artisan config:publish pragmarx/tracker
Laravel 5
php artisan vendor:publish --provider="PragmaRX\Tracker\Vendor\Laravel\ServiceProvider"
Enable the Middleware (Laravel 5)
Open the newly published config file found at
app/config/tracker.php
and enable use_middleware:'use_middleware' => true,
Add the Middleware to Laravel Kernel (Laravel 5)
Open the file
app/Http/Kernel.php
and add the following to your web middlewares:\PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,
…
If you removed the package, make sure to
- delete the
config/tracker.php
file - remove the line
PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class
fromconfig/app.php
- remove the line
'Tracker' => 'PragmaRX\Tracker\Vendor\Laravel\Facade',
fromconfig/app.php
- remove the line
\PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,
fromapp/Http/Kernel.php