Download the PHP package spie/laravel-jwt without Composer

On this page you can find all versions of the php package spie/laravel-jwt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-jwt

JWT Package for Laravel

Build Status Coverage Status StyleCI

This package provides a Laravel Guard for JWT authentication.

This package provides a access and refresh token workflow. You need to create an access token first. With the access token you can issue a refresh token. Then this refresh token can be used to create access tokens if required.

Requirements

Installation

Just pull the package with composer

Laravel

Add the SPie\LaravelJWT\Providers\LaravelServiceProvider to the providers array in config/app.php.

Lumen

In bootstrap/app.php add Illuminate\Auth\AuthServiceProvider and SPie\LaravelJWT\Providers\LumenServiceProvider.

Configuration

JWT

You can configure the JWT package in your .env file. You can find the available config options in the .env.example file.

You can also copy the config/jwt.php file from the repo to your projects config directory to configure JWT without an .env file.

It is required to add a value for JWT_SECRET and JWT_ISSUER. For every other config a default value exists.

Auth

You need to add an entry for the JWTGuard in your config/auth.php file.

Usage

You can use the SPie\LaravelJWT\Auth\JWTGuard by using dependency injection and depend on Illuminate\Contracts\Auth\Guard, but you have to bind the JWTGuard to SPie\LaravelJWT\Auth\JWTGuard to Illuminate\Contracts\Auth\Guard in your ServiceProvider. You can also get the JWTGuard by Illuminate\Auth\AuthManager::guard($name), using the guard name configured in config/auth.php.

User

To use your user model for authentication, it has to implement the SPie\LaravelJWT\Contracts\JWTAuthenticatable interface.

Login

To Login use the login method provided by Illuminate\Contracts\Auth\StatefulGuard. After that you can get the Access and Refresh token by the getAccessToken and getRefreshToken methods.

Logout

The JWTGuard::logout() method will unset the $jwt and $user property. If a TokenBlacklist is configured, the token will be revoked. If a refresh token was used, it will get revoked.

TokenProvider

You have to specify a TokenProvider to be able to extract a token from request. This package includes two TokenProvider already: the SPie\LaravelJWT\TokenProvider\HeaderTokenProvider and the SPie\LaravelJWT\TokenProvider\CookieTokenProvider. Of course, you can create a custom TokenProvider, implementing the SPie\LaravelJWT\Contracts\TokenProvider interface and specify it in the JWT config. You have to specify a TokenProvider for refresh tokens too.

JWTHandler

To create or validate JWTs, you can use the SPie\LaravelJWT\JWTHandler.

Create JWT

To create a JWT, you have to provide a subject and an optional payload and TTl.

Get valid JWT

To validate a JWT, you have to provide the token as string. You will get a SPie\LaravelJWT\JWT object, if the token is valid, or a specific JWTException.

Possible exceptions are:

If the setting JWT_IP_CHECK_ENABLED is set, the IP address will be compared with the one. If they don't match, the user is not authenticated.

JWT Object

The SPie\LaravelJWT\JWT object is just a wrapper for Lcobucci\JWT\Token. To get the string representation of the JWT, you have to call the JWT::getJWT() method.

TokenBlacklist

The JWTGuard can use a token blacklist. The token blacklist has to implement the SPie\LaravelJWT\Contracts\TokenBlacklist interface. The interface provide two methods: revoke(SPie\LaravelJWT\JWT $jwt) and isRevoked(string $jwt). The revoke method will store the JWT until it would expire, or forever if no expiration date is set. The isRevoked method will check for a revoked token.

RefreshTokenRepository

You have to implement the SPie\LaravelJWT\RefreshTokenRepository if you want to use refresh tokens. The RefreshTokenRepository will store and revoke the refresh tokens if needed and also checks if a refresh token is already revoked.


All versions of laravel-jwt with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
illuminate/auth Version >=7.0
illuminate/config Version >=7.0
illuminate/console Version >=7.0
illuminate/contracts Version >=7.0
illuminate/support Version >=7.0
illuminate/cache Version >=7.0
lcobucci/jwt Version ^4.0
nesbot/carbon Version ^2.0
vlucas/phpdotenv Version ^4.0 || ^5.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package spie/laravel-jwt contains the following files

Loading the files please wait ....