PHPackages                             altelma/php-jwt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. altelma/php-jwt

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

altelma/php-jwt
===============

Creating and Verifying JWT Signatures in PHP using HS256 and RS256.

v1.1(7y ago)043MITPHP

Since Feb 21Pushed 7y agoCompare

[ Source](https://github.com/ALTELMA/php-jwt)[ Packagist](https://packagist.org/packages/altelma/php-jwt)[ RSS](/packages/altelma-php-jwt/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

[![JWT](https://camo.githubusercontent.com/9ed15a405323780eab6ff9683d20d26a1dbcd84d1ce926c9df6a8404b89ec061/68747470733a2f2f6368617468752e6d652f323031372f30382f32382f6a77742d696e74726f64756374696f6e2f62616e6e65722e6a7067)](https://camo.githubusercontent.com/9ed15a405323780eab6ff9683d20d26a1dbcd84d1ce926c9df6a8404b89ec061/68747470733a2f2f6368617468752e6d652f323031372f30382f32382f6a77742d696e74726f64756374696f6e2f62616e6e65722e6a7067)

Simple JWT for Larvel
---------------------

[](#simple-jwt-for-larvel)

Simple library creating and verify JWT Signatures in PHP using HS256 and RS256.

### Setup

[](#setup)

- Run `$ composer require altelma/php-jwt`

#### Laravel

[](#laravel)

- **(Only for Laravel 5.5 or minor)** Add provider to config/app.php

```
'providers' => [
    Altelma\JWT\JWTServiceProvider::class,
],
```

- Run `$ php artisan vendor:publish` to publish the configuration file `config/jwt.php` and insert:
    - private\_key
    - public\_key

#### Lumen

[](#lumen)

- Add provider to `bootstrap/app.php`

```
$app->register(Altelma\JWT\JWTServiceProvider::class);
```

- Copy `vendor/altelma/php-jwt/config/jwt.php` to `config/jwt.php` and insert:

    - private\_key
    - public\_key
- Add config to `bootstrap/app.php`

```
$app->configure('jwt');
```

- Allow call package via Facade, uncomment

```
$app->withFacades();

if (!class_exists('JWT')) {
    class_alias('Altelma\JWT\JWTFacade', 'JWT');
}
```

### Basic usage

[](#basic-usage)

The following example is for generate JWT

```
