Download the PHP package codecasts/laravel-jwt without Composer

On this page you can find all versions of the php package codecasts/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

Readme Art

Laravel JWT

Latest Stable Version Total Downloads License

This package provides out-of-the-box API authentication using JWT for Laravel.

Installation.

You can install this package by running:

Setup.

In order to setup this package into your application, minimal configuration is actually needed.

1) Service Provider.

Register this package's Service Provider by adding it to the providers section of your config/app.php file:

You may skip this step on Laravel 5.5 due to the auto-discovery package feature.

2) Configuration file.

Publish the configuration file (config/jwt.php) by running the following command after registering the Service Provider.

3) Generate a Secret.

In order for this package to works, you will need a separate secret (do not use the application key).

This package provides a command that can be used for generating a strong key.

Get a new key by running:

Then, copy the generated key contents into your .env file.

NOTICE: The key generation process will not automatically set it inside your .env file, do it manually.

4) Setup Guard

In order to automatically authenticate your routes using JWT tokens, you need to change the guard driver to jwt

Inside config/auth.php set the corresponding guard group you want to protect:

If you have the default guard group named api, your auth.php should be like this:

That's it, we are all ready to use it.

Usage.

This package aims to be dead simple to use.

The following templates can be used to setup your existing authentication controllers and resources.

NOTICE: Full working examples of use for this package will be added on this package when it reaches it's 1.0 version.

Protecting Routes.

This package is fully integrated with Laravel Authentication.

The default configuration (config/jwt.php) brings a sensitive value that is very useful when your application is not completely an API: middleware_match

By not completely an API, I mean, the JWT guard is not the default one.

In those cases, in order to use the auth middleware, the config key middleware_match MUST be set to true.

This configuration key allows non protected routes to work properly.

Notice that this option will match middleware group names with guard names.

In this case, the 'api' middleware group will always use the api guard.

Also, the 'web' middleware group will always use the web guard

If you do not use this value, you will need to use suffixes when referencing the auth middleware, like auth:api.

Issuing and Renewing Tokens.

For issuing tokens, no special class is actually needed, you can just expect create a Guard current implementation from the IoC and work from there.

Check out the examples.

On the following examples, all Guard instances are injected from Illuminate\Contracts\Auth\Guard

On the following examples, all Request instances are injected from Illuminate\Http\Request

Token from User Instance.

This method should be used when you just registered a user and any other special cases.

Token from User Credentials.

This method should be used when you just registered a user and any other special cases.

Refreshing Tokens.

Tokens can be refreshed in 2 different ways: Auto detect or manual.

If you do not pass any argument into the refresh method, the Guard will look for either a Authorization header or a token field on the request's body.

Custom Claims.

Of course, there are support for custom claims.

You can set them in two ways.

By explicitly passing them.

By Authenticatable method.

If all your users will have the same custom claims, you can setup a default custom claims method on your User's model (or any other Authenticatable you're using):

If the method customJWTClaims() is present on the model being issue the token against, this claims will be automatically included.

Contributing

Please see CONTRIBUTING for details.


All versions of laravel-jwt with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
ext-openssl Version *
lcobucci/jwt Version ^3.2
illuminate/support Version >=5.4.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 codecasts/laravel-jwt contains the following files

Loading the files please wait ....