Download the PHP package dkrasov/jwt-auth-guard without Composer

On this page you can find all versions of the php package dkrasov/jwt-auth-guard. 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 jwt-auth-guard

JWT Auth Guard

Join PHP Chat Chat on Telegram Laravel Package Latest Version on Packagist Total Downloads

JWT Auth Guard is a Laravel & Lumen Package that lets you use jwt as your driver for authentication guard in your application.

The Guard uses tymon/jwt-auth package for authentication and token handling.

Requirements

Pre-Installation

First install and setup tymon/jwt-auth package.

Once done, config it and then install this package.

Install

Via Composer

Add the Service Provider

Laravel

Open config/app.php and, to your providers array at the bottom, add:

Lumen

Open bootstrap/app.php and register the service provider:

Usage

Open your config/auth.php config file and in place of driver under any of your guards, just add the jwt-auth as your driver and you're all set. Make sure you also set provider for the guard to communicate with your database.

Setup Guard Driver

Middleware Usage

Middleware protecting the route:

Middleware protecting the controller:

Note: The above example assumes you've setup a guard with the name api whose driver is jwt-auth in your config/auth.php file as explained in "Setup Guard Driver" section above.

The following usage examples assume you've setup your default auth guard to the one which uses the jwt-auth driver.

You can also explicitly define the guard before making calls to any of methods by just prefixing it with Auth::guard('api').

Example: Auth::guard('api')->user()

Attempt To Authenticate And Return Token

Authenticate Once By ID

Authenticate Once By Credentials

Validate Credentials

Check User is Authenticated

Check User is a Guest

Logout Authenticated User

Generate JWT Auth Token By ID

Get Authenticated User

Once the user is authenticated via a middleware, You can access its details by doing:

You can also manually access user info using the token itself:

Get Authenticated User's ID

Refresh Expired Token

Though it's recommended you refresh using the middlewares provided with the package, but if you'd like, You can also do it manually with this method.

Refresh expired token passed in request:

Refresh passed expired token:

Invalidate Token

Invalidate token passed in request:

Invalidate token by setting one manually:

Get Token

Get Token Payload

This method will decode the token and return its raw payload.

Get Payload for the token passed in request:

Get Payload for the given token manually:

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

Contributing

Please see CONDUCT for details.

Any issues, feedback, suggestions or questions please use issue tracker here.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of jwt-auth-guard with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
illuminate/support Version ~5.0
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 dkrasov/jwt-auth-guard contains the following files

Loading the files please wait ....