Composer无法安装tymon / jwt-auth

时间:2017-10-19 09:35:36

标签: php json composer-php laravel-5.5

请协助,作曲家无法安装tymon / jwt-auth:0.5。*

我有类型:

composer require tymon/jwt-auth:0.5.*

我还尝试在项目composer.json中添加ff:

    require {
....
"tymon/jwt-auth": "dev-master", 
....

}

和“tymon / jwt-auth”:“0.5。*”分别

请注意:我是laravel的新手......

8 个答案:

答案 0 :(得分:2)

我找到了(临时)解决方案。
要获得Laravel 5.8的兼容性,请执行:

composer require tymon/jwt-auth ^1.0.0-rc.4.1

请参阅this Github issue中的讨论。

答案 1 :(得分:1)

这个命令对我有用:

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": "^7.3|^8.0",
    "fideloper/proxy": "^4.4.1",
    "fruitcake/laravel-cors": "^2.0.3",
    "guzzlehttp/guzzle": "^7.0.1",
    "laravel/framework": "^8.0",
    "laravel/passport": "^10.0",
    "laravel/tinker": "^2.5|dev-develop",
    "paragonie/random_compat": "2.*"
    
},
"require-dev": {
    "fakerphp/faker": "^1.9.1",
    "mockery/mockery": "^1.4.2",
    "nunomaduro/collision": "^5.0",
    "phpunit/phpunit": "^9.3.3"
},
"config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "sort-packages": true
},
"extra": {
    "laravel": {
        "dont-discover": []
    }
},
"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Database\\Factories\\": "database/factories/",
        "Database\\Seeders\\": "database/seeders/"
    }
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    }
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
    "post-autoload-dump": [
        "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
        "@php artisan package:discover --ansi"
    ],
    "post-root-package-install": [
        "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "@php artisan key:generate --ansi"
    ]
}
}

答案 2 :(得分:0)

您可以通过简单的composer require tymon/jwt-auth

获得0.5版本

要从0.5开始指定,您可以使用composer require tymon/jwt-auth:^0.5

答案 3 :(得分:0)

  

要安装此软件包,您需要:

Laravel 4 or 5 (see compatibility table)
PHP 5.4 +
     

通过composer安装 - 编辑你的composer.json以获取包。

"require": {
    "tymon/jwt-auth": "0.5.*" 
}
     

然后在您的终端中运行composer update以将其拉入。

安装在那里https://github.com/tymondesigns/jwt-auth/wiki/Installation 关于dev-master没有任何说法,请尝试使用0.5.*

答案 4 :(得分:0)

要在PHP laravel中安装tymon / jwt-auth软件包,应该按照以下步骤操作:

Composer.json要求应该是这样的:

"require": {
       "php": ">=5.5.9",
       "laravel/framework": "5.1.*",
       "tymon/jwt-auth": "0.5.*"
   },

然后在config / app.php中将以下内容放在providers数组中:

Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class

然后在config / app.php的别名数组中添加以下内容

'JWTAuth'   => Tymon\JWTAuthFacades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuthFacades\JWTFactory::class

然后输入以下命令:

php artisan vendor:publish

注意:各种教程会建议你以下php工匠供应商:发布--provider =“Tymon \ JWTAuthProviders \ JWTAuthServiceProvider”,但是尝试上面的命令,即没有--provider,它会工作

然后输入:

php artisan jwt:generate

完成此步骤后,您可以在app / config / jwt.php中验证生成的密钥,如下所述:

'secret' => env('JWT_SECRET', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),

答案 5 :(得分:0)

Laravel 8:

composer require tymon/jwt-auth:^1.0.2

答案 6 :(得分:0)

根据this Github issue

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

非常适合我

答案 7 :(得分:0)

使用“--ignore-platform-reqs”

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