Please assist, composer could not install tymon/jwt-auth:0.5.*
I had type:
composer require tymon/jwt-auth:0.5.*
i also tried to add the ff in projects composer.json:
require {
....
"tymon/jwt-auth": "dev-master",
....
}
and "tymon/jwt-auth": "0.5.*" respectively
Plase note: I am new to laravel...
In the case of laravel 9.11:
Typing this command:
composer require tymon/jwt-auth
OutPut an Error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires tymon/jwt-auth ^0.5.12 -> satisfiable by tymon/jwt-auth[0.5.12].
- tymon/jwt-auth 0.5.12 requires illuminate/support ~5.0 -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
This command worked for me in Laravel 8 to Laravel 9.11:
composer require -w tymon/jwt-auth --ignore-platform-reqs
composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.11",
"laravel/sanctum": "^2.14.1",
"laravel/tinker": "^2.7",
"tymon/jwt-auth": "^1.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
I found a (temporary) solution.
To get Laravel 5.8 compatibility, perform:
composer require tymon/jwt-auth ^1.0.0-rc.4.1
See discussion in this Github issue .
To install this package you will need:
Laravel 4 or 5 (see compatibility table) PHP 5.4 +
Install via composer - edit your composer.json to require the package.
"require": { "tymon/jwt-auth": "0.5.*" }
Then run
composer update
in your terminal to pull it in.
The installation is there https://github.com/tymondesigns/jwt-auth/wiki/Installation There is nothing said about dev-master
, try with 0.5.*
According to this Github issue
composer require tymon/jwt-auth --ignore-platform-reqs
Worked for me perfectly
使用“--ignore-platform-reqs”
composer require tymon/jwt-auth --ignore-platform-reqs
You may get a 0.5 version by a simple : composer require tymon/jwt-auth
To specify from 0.5, you may use composer require tymon/jwt-auth:^0.5
To install the tymon/jwt-auth package in PHP laravel, one should follow the following steps:
Composer.json require should be like this:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"tymon/jwt-auth": "0.5.*"
},
Then in config/app.php put the following in the providers array:
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class
Then in the aliases array in the config/app.php add the following
'JWTAuth' => Tymon\JWTAuthFacades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuthFacades\JWTFactory::class
Then type the following command:
php artisan vendor:publish
Note: Various tutorial will suggest you the following php artisan vendor:publish --provider="Tymon\JWTAuthProviders\JWTAuthServiceProvider" but befor that try the above command ie without --provider and it will work
Then type:
php artisan jwt:generate
After this step you can verify the generated key in app/config/jwt.php as mentioned below:
'secret' => env('JWT_SECRET', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
Laravel 8:
composer require tymon/jwt-auth:^1.0.2
composer require tymon/jwt-auth --ignore-platform-reqs
npm install --save jwt-simple
完美地为我工作。
according to my idea better use below command. composer require tymon/jwt-auth --ignore-platform-reqs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.