user4106707
user4106707

Reputation: 89

Class not found in ProviderRepository.php error with composer install

I'm currently in the process of trying to include this package in my Laravel app: https://github.com/tappleby/laravel-auth-token

I included "tappleby/laravel-auth-token": "0.3.*" in composer.json, like this:

"require": {
    "laravel/framework": "4.2.*",
    "intervention/image": "dev-master",
    "laracasts/flash": "~1.0",
    "laracasts/validation": "1.1.*",
    "tappleby/laravel-auth-token": "0.3.*"
}

And I added 'Tappleby\AuthToken\AuthTokenServiceProvider' and 'AuthToken'=>'Tappleby\Support\Facades\AuthToken','AuthTokenNotAuthorizedException' =>'Tappleby\AuthToken\Exceptions\NotAuthorizedException' to app/config/app.php.

Afterwards I ran composer install. This is the way I always added packages, but now I get an error every time: [RuntimeException]
Error Output: PHP Fatal error: Class 'Tappleby\AuthToken\AuthTokenServiceProvider' not found in /var/www/example.com/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157

Upvotes: 7

Views: 22847

Answers (6)

Mihai Crăiță
Mihai Crăiță

Reputation: 3417

Your config file may be cached. Remove all files from bootstrap/cache/*

after that run

composer install --optimize-autoloader --no-dev

php artisan config:cache

Upvotes: 0

geral
geral

Reputation: 41

php artisan optimize:clear

composer install

If that don't work

  1. remove composer.lock
  2. remove vendor folder
  3. composer install

Upvotes: 4

Pasan Bhanu Guruge
Pasan Bhanu Guruge

Reputation: 286

Goto bootstrap/cache folder and delete config.php

Then run

composer dump-autoload

Upvotes: 18

Muhammad
Muhammad

Reputation: 931

As Marcin said you shouldn't use

composer install

but

composer update

Second thing remove all the lines added to app/config/app.php

First run composer update after that put those lines in app/config/app.php

Then run php artisan config:publish tappleby/laravel-auth-token in your command line

It should publish your configuration and now you should be able to use the relevant classes

Upvotes: 7

Marcin Nabiałek
Marcin Nabiałek

Reputation: 111859

You should run:

composer update

and not

composer install

When adding new dependency you should always use composer update to update your project and not composer install

Upvotes: 1

Razor
Razor

Reputation: 9835

Order is mandatory, run composer update then add the service provider and aliases to app.php

Upvotes: 4

Related Questions