Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.6.26 Error- Class 'Tymon\JWTAuth\Providers\LaravelServiceProvider' not found

Tags:

php

laravel

FYI,

I have gone through several web links and found solutions like changing/adding to composer.json file

"tymon/jwt-auth": "^0.5.12" 
"tymon/jwt-auth": "^1.0.0-beta.3" 
"tymon/jwt-auth": "^1.0.0-rc.2"

app.php config file with LaravelServiceProvider/JWTAuthServiceProvider

providers => [
---
        Tymon\JWTAuth\Providers\LaravelServiceProvider::class,

        Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
---
]
aliases => [
-----
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
-----
]

And

composer update --no-scripts
composer update

When publishing:

php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"

Error message below.

In ProviderRepository.php line 208:

  Class 'Tymon\JWTAuth\Providers\LaravelServiceProvider' not found

composer update output below

$composer update

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework v5.6.26
    - Conclusion: don't install laravel/framework v5.6.26
    - Installation request for tymon/jwt-auth 1.0.0-beta.3 -> satisfiable by tymon/jwt-auth[1.0.0-beta.3].
    - Conclusion: don't install laravel/framework v5.6.1
    - Conclusion: don't install laravel/framework v5.6.0
    - tymon/jwt-auth 1.0.0-beta.3 requires illuminate/auth 5.1.* || 5.2.* || 5.3.* || 5.4.* -> satisfiable by illuminate/auth[5.1.x-dev].

    - Installation request for laravel/framework 5.6.* -> satisfiable by laravel/framework[5.6.x-dev].

Thanks in advance.

like image 820
Gowtham Avatar asked Jun 22 '18 11:06

Gowtham


1 Answers

Add library to composer.json:

"require": {
    ...
    "tymon/jwt-auth": "1.0.0-beta.3"
    ...
 },

Run this command in console: composer update

Add provider in config/app.php:

'providers' => [
    ...
    Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
    ...
],

Add aliases in the same file `config/app.php':

'aliases' => [
    ...
    'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
    'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
    ...
],

And then run command in console: php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider" next run:

php artisan jwt:secret
like image 189
Sachin Ingale Avatar answered Oct 22 '22 09:10

Sachin Ingale