jwt-auth
jwt-auth copied to clipboard
Need support for PHP 8.0
Subject of the issue
Describe your issue here.
Your environment
Q | A |
---|---|
Bug? | yes |
New Feature? | yes |
Framework | Laravel |
Framework version | 8.x.y |
Package version | 4.x.y |
PHP version | 8.x.y |
Kindly give support for PHP 8.x
I work using PHP 8 latest version (the version of this comment is 8.0._1) and works fine and well.
Anyway, you didn't describe your issue too.
@Messhias : Thanks for your time & reply. Kindly have a look on the below screenshot. Kindly help me to fix this issue.

The problem's not this package, it's your laravel framework version, past your composer.json file.
@Messhias FYI
composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=8.0",
"laravel/framework": "8.5",
"tymon/jwt-auth": "1.0.2",
"doctrine/dbal": "3.1.0",
"league/flysystem-aws-s3-v3": "~1.0",
"aws/aws-sdk-php": "3.183.9",
"yajra/laravel-datatables-oracle": "9.18.0",
"aws/aws-sdk-php-laravel": "3.6.0",
"guzzlehttp/guzzle": "7.3.0",
"dusterio/laravel-aws-worker": "^0.1.9",
"maatwebsite/excel": "3.1.30",
"maxbanton/cwh": "2.0.2",
"wisembly/elephant.io": "3.3.1",
"mjaschen/phpgeo": "3.2.1",
"predis/predis": "1.1.7",
"laravelcollective/html": "6.2.1",
"tijsverkoyen/css-to-inline-styles": "2.2.3",
"laravel/tinker": "2.6.1",
"laravel/ui": "3.0",
"yajra/laravel-datatables-html": "4.37.0",
"yajra/laravel-datatables-buttons": "4.13.0",
"barryvdh/laravel-dompdf": "^0.9.0"
},
"require-dev": {
"facade/ignition": "2.9",
"fakerphp/faker": "1.14.1",
"mockery/mockery": "1.4.3",
"nunomaduro/collision": "5.4",
"phpunit/phpunit": "9.5.4"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"psr-0": {
"Packages": "app/"
},
"files": [
"app/Http/helpers.php",
"app/Http/config-helpers.php",
"app/Http/blade-helpers.php",
"app/Http/constants.php",
"tests/utilities/functions.php"
]
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
],
"psr-4": {
"Test\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
Hmmm, your composer it's quite larger than mine, but I'll post my composer require section for your reference because at least the commons packages seem different from mine.
Here:
"php": "^8.0",
"ext-json": "*",
"aws/aws-sdk-php-laravel": "~3.0",
"darkaonline/l5-swagger": "^8.0",
"facade/ignition": "^2.3.6",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"goetas-webservices/xsd-reader": "^0.3.6",
"guzzlehttp/guzzle": "^7.0.1",
"illuminate/console": "^8.42",
"intervention/image": "^2.5",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.0",
"league/flysystem-aws-s3-v3": "^1.0",
"maatwebsite/excel": "^3.1",
"monarobase/country-list": "^3.2",
"owen-it/laravel-auditing": "^12.0",
"predis/predis": "^1.1",
"pusher/pusher-php-server": "^6.1",
"s-ichikawa/laravel-sendgrid-driver": "^3.0",
"thedoctor0/laravel-mailjet-driver": "^1.0",
"twilio/sdk": "^6.24",
"tymon/jwt-auth": "^1.0",
"vlucas/phpdotenv": "^5.2",
"zircote/swagger-php": "^3.1",
"ext-pdo": "*"
```
Work fine on PHP 8.0
with composer param --ignore-platform-reqs , it's OK.
The package doesn't support PHP 8.0
tymon/jwt-auth[1.0.0-rc.5, ..., 1.0.2] require php ^5.5.9|^7.0 -> your php version (8.0.5) does not satisfy that requirement.
The package doesn't support PHP 8.0
tymon/jwt-auth[1.0.0-rc.5, ..., 1.0.2] require php ^5.5.9|^7.0 -> your php version (8.0.5) does not satisfy that requirement.
As @cjango told you, try to use --ignore-platform-reqs.
And for me works fine without --ignore-platform-reqs, might be there's another library you're using that's blocking your composer package.
I'll show my composer.json as an example for you to take as reference:
"php": "^8.0",
"ext-json": "*",
"aws/aws-sdk-php-laravel": "~3.0",
"darkaonline/l5-swagger": "^8.0",
"facade/ignition": "^2.3.6",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"goetas-webservices/xsd-reader": "^0.3.6",
"guzzlehttp/guzzle": "^7.0.1",
"illuminate/console": "^8.42",
"intervention/image": "^2.5",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.0",
"league/flysystem-aws-s3-v3": "^1.0",
"maatwebsite/excel": "^3.1",
"monarobase/country-list": "^3.2",
"owen-it/laravel-auditing": "^12.0",
"predis/predis": "^1.1",
"pusher/pusher-php-server": "^6.1",
"s-ichikawa/laravel-sendgrid-driver": "^3.0",
"thedoctor0/laravel-mailjet-driver": "^1.0",
"twilio/sdk": "^6.24",
"tymon/jwt-auth": "^1.0",
"vlucas/phpdotenv": "^5.2",
"zircote/swagger-php": "^3.1",
"ext-pdo": "*"
The following command worked to me:
composer require tymon/jwt-auth dev-develop
The following command worked to me:
composer require tymon/jwt-auth dev-develop
Bout time someone worked that out lol
i just put it line in composer.json in the section require "tymon/jwt-auth": "^1.0"
and after composer update
, i worked well
The package seems to update to dev-develop
now by default.
Before:
"name": "tymon/jwt-auth",
"version": "1.0.2",
After running composer update with unchanged configuration "tymon/jwt-auth": "^1.0.0"
:
"name": "tymon/jwt-auth",
"version": "dev-develop",
Seems like this lib should upgrade because tymon/jwt-auth dev-develop requires lcobucci/jwt <3.4
lcobucci/jwt[3.3.0, ..., 3.3.3] require php ^5.6 || ^7.0 -> your php version (8.0.11) does not satisfy that requirement.
Pssst, PHP 8.1 is out :-D
Pssst, PHP 8.1 is out :-D
https://github.com/PHP-Open-Source-Saver/jwt-auth/discussions/76
Here we're keeping the branch going forward.
tymon/jwt-auth in php 8.1 need lcobucci/jwt < 3.4, but all versions lower than 3.4 need php ^7.0 only
tymon/jwt-auth in php 8.1 need lcobucci/jwt < 3.4, but all versions lower than 3.4 need php ^7.0 only
FTR, as already pointed out, this is fixed in the fork at https://github.com/PHP-Open-Source-Saver/jwt-auth which supports 7.4,8+ and uses lcobucci/jwt 4
PHP Deprecated: Return type of Lcobucci\JWT\Claim\Basic::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/www/crm/vendor/lcobucci/jwt/src/Claim/Basic.php
Not support php 8.1
I am getting this error after updating my php version
<br/><b>Deprecated</b>: ReturntypeofTymon\JWTAuth\Claims\Claim: : jsonSerialize()shouldeitherbecompatiblewithJsonSerializable: : jsonSerialize(): mixed, orthe#[ \ReturnTypeWillChange ]attributeshouldbeusedtotemporarilysuppressthenoticein<b>/Users/saifurrahman/www/lumen-jwt-auth/vendor/tymon/jwt-auth/src/Claims/Claim.php</b>online<b>147</b><br/>{ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sdW1lbi1qd3QtYXV0aC50ZXN0XC9hcGlcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNjQwOTIxNzQ1LCJleHAiOjE2NDA5MjUzNDUsIm5iZiI6MTY0MDkyMTc0NSwianRpIjoiOXlWc1NQUm9wUG1lVG5mWiIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.p3Blmp1_sJtozADqFPBjavGtf_NPmpJUBjhgez_ENYE", "token_type": "bearer", "expires_in": 3600 }
Php version:
PHP 8.1.0 (cli) (built: Nov 28 2021 01:31:19) (NTS)
Composer.json
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.3|^8.0",
"flipbox/lumen-generator": "^8.2",
"laravel/lumen-framework": "^8.3.1",
"tymon/jwt-auth": "dev-develop"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^9.5.10"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
}
}
Please help someone.
@saifur-rahman-hasan not sure it support 8.1 yet. I was having exact error as yours while trying to run Laravel test on php 8.1. You should use 8.0
Version 1.0.2 does not support PHP 8, you can just see it here: https://packagist.org/packages/tymon/jwt-auth , the same with version 2.0.0.
It's also a problem with 8.1
Couple of things for people commenting here after my comment https://github.com/tymondesigns/jwt-auth/issues/2141#issuecomment-990154168
- it's not an error, it's a DEPRECATION WARNING It's best practice to disable them in production, btw
- that said, https://github.com/tymondesigns/jwt-auth/issues/2141#issuecomment-990154168 leads to a forked version of this library which supports 8 and later versions
✌🏼
@mfn If this package is deprecated then it should be something on the front page about it. But current'y this one has 10k stars and PHP-Open-Source-Saver has just 87. Current package has no any release that supports PHP 8. I'd not pull development version for production app, either I'd not use some unknown fork with little contribution for production app.
It's pretty clear the repository has been abandoned. Use the recommended fork or fork and do your own thing.
@vedmant
If this package is deprecated then it should be something on the front page about it
I agree, but that maintainer hasn't been active in in a year, so draw your own conclusion.
@vedmant
If this package is deprecated then it should be something on the front page about it
I agree, but that maintainer hasn't been active in in a year, so draw your own conclusion.
👍
@mfn If this package is deprecated then it should be something on the front page about it. But current'y this one has 10k stars and PHP-Open-Source-Saver has just 87. Current package has no any release that supports PHP 8. I'd not pull development version for production app, either I'd not use some unknown fork with little contribution for production app.
This package has been abandoned, I tried to enter in contact by email with @tymondesigns, and I tried also to contribute, as you can the package is going to be 2 years without updates, without issues answering.
The fact the repository has 10k stars or 0 doesn't mean anything, as @mfn told you, just look at the repository update history and draw your own conclusions.