6

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.

Md. Imrul Kayes
  • 819
  • 6
  • 13
Neo Sono
  • 186
  • 1
  • 4
  • 18
  • 2
    Any Error message? – Thielicious Oct 19 '17 at 09:38
  • I get :C:\xampp\my_xamp\htdocs\shops\laravel55>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 - The requested package tymon/jwt-auth could not be found in any version, there may be a typo in the package name. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting – Neo Sono Oct 19 '17 at 09:40
  • Having the same problem as the OP with PHP 7.3.1 and Laravel 5.8.26. – Andre Polykanine Jul 01 '19 at 21:42

10 Answers10

15

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
    }
Md. Imrul Kayes
  • 819
  • 6
  • 13
Zia Yamin
  • 942
  • 2
  • 10
  • 34
6

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.

Andre Polykanine
  • 3,291
  • 18
  • 28
2

use "--ignore-platform-reqs"

composer require tymon/jwt-auth --ignore-platform-reqs

ahmedkandil
  • 477
  • 3
  • 6
1

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.*

Thielicious
  • 4,122
  • 2
  • 25
  • 35
  • I am using "php": ">=7.0.0",( FYI: laravel 5.5.13 and composer 1.5.2), Does it still aply to php 7... ? – Neo Sono Oct 19 '17 at 10:03
  • Yes, there you go – Thielicious Oct 19 '17 at 10:10
  • yes, what Thielicious? what must I do ? because I have php 7 . Must I downgrade to php 5.6 maybe? is that what You say ? – Neo Sono Oct 19 '17 at 10:18
  • @Neo Sono Excuse me? I am not the one who made this API. If it says `5.4 +` there is no need to downgrade so follow the installation because according to your compatibility this should actually work. Go to the repository under Issues, I see there are people having diverse problems – Thielicious Oct 19 '17 at 10:22
1

According to this Github issue

composer require tymon/jwt-auth --ignore-platform-reqs

Worked for me perfectly

amirhesni
  • 441
  • 1
  • 6
  • 22
0

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

Alexander Morland
  • 6,356
  • 7
  • 32
  • 51
0

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'),
Honey Thakuria
  • 223
  • 3
  • 16
  • 2
    Thanks. But I've moved on with Java Spring MVC 4/5 AND HIBERNATE... AND ITS LOT OF FUN THERE... WELL GOOD BYE TO PHP. .. – Neo Sono Jul 19 '19 at 16:40
0

Laravel 8:

composer require tymon/jwt-auth:^1.0.2
oviniciusfeitosa
  • 915
  • 1
  • 11
  • 12
-1
npm install --save jwt-simple

Worked for me perfectly.

S.B
  • 13,077
  • 10
  • 22
  • 49
  • 1
    Please add some explanation to your answer such that others can learn from it. How could the given command install a PHP package? – Nico Haase Jun 09 '22 at 10:20
-2

according to my idea better use below command. composer require tymon/jwt-auth --ignore-platform-reqs

L.Chamika
  • 41
  • 1
  • What do you mean by "better"? Isn't this the same command that has been part of at least three other answers on this site? Please do not duplicate existing answers, unless you share some new insights – Nico Haase Dec 16 '21 at 16:16
  • don't copy existing answer – Code Kris May 27 '22 at 04:51