josegarcia / jwt-auth
A simple JWT authentication library
1.1.1
2024-03-11 01:03 UTC
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.51
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.9
- vimeo/psalm: ^5.22
README
- This package is a simple JWT (JSON Web Token) library for PHP. It is easy to use and works with any PHP framework, library, or application.
Description
- This package is a simple JWT (JSON Web Token) library for PHP. It is easy to use and works with any PHP framework, library, or application.
Features
- No configuration required.
- No dependencies.
- Lightweight.
- Easy to use.
- Works with PHP 7.4 and above.
- Works with any PHP framework, library, or application.
Installation
composer require josegarcia/jwt-auth
Usage
<?php require_once 'vendor/autoload.php'; use Garcia\JWT; $jwt = new JWT('secret'); $payload = [ 'user_id' => 1, 'username ' => 'johndoe', 'email' => 'testing@testing.com', 'role' => 'admin' ]; $token = $jwt->encode($payload); echo "$token \n\n"; $decoded = $jwt->decode($token); var_dump($decoded);
License
- This package is open-sourced software licensed under the MIT license.