Download the PHP package mayoz/laravel-tokens without Composer

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

Laravel Multi Token

Latest Version on Packagist Quality Score StyleCI Total Downloads

Introduction

This package provides a simple solution for give multiple token to your application's users. This solution is similar to Laravel's TokenGuard class.

This package is for Laravel 5.5 and above.

Installation

You can install the package via composer using:

The service provider will automatically get registered for Laravel 5.5 and above versions. If you want you can add the service provider in config/app.php file:

If you are going to make changes the default migration, you can publish the migration file with:

Then, you can create the tokens table by running the migrations:

You can publish the config file with:

If you need you are free to change your config file.

Implementation

After installation, you can implement the new feature for your application.

Add the Mayoz\Token\HasToken trait to your App\User model. This trait will provide a few helper methods to your model which allow you to inspect the authenticated user's tokens:

And finally, you will add the new guard to your application. Open the config/auth.php file and apply following changes:

Congratulations!

Usage

When you need it (after login or any actions later), use the helper function to create a new token.

By default tokens never expire if you do not pass the lifetime when generation. For define expiration, you can pass the time period parameter (in minutes) to generateToken method.

Generate a new token of 10 minutes life with:

The token are not refreshed, token will die when expired. The authentication attempts with expired token will fail.

The authentication process is similar to that of the standard Laravel api_token flows:

The token guard is looking for the token:

  1. Firstly looking the URL for parameter ?api_token=XXX
  2. If not exists token, looking the header for Authorization: Bearer XXX

Finally, if you need the current token model information underlying the authentication process, you can use the token method.

Token Generator

By default, the generated token is a string of random 36 chars. If you want to create more meaningful (such as uuid4) tokens, you are free to change the generator method.

Let's make change to generate of uuid4 string. Open the app/Providers/AuthServiceProvider file and apply the additions:

If there is no ramsey/uuid package in your application, you can install with:

Cheers.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

If you discover any security related issues, please create a new issue with using the "Bug" label. All security vulnerabilities will be promptly addressed.

License

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


All versions of laravel-tokens with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0.0
illuminate/auth Version ~5.5
illuminate/contracts Version ~5.5
illuminate/http Version ~5.5
illuminate/queue Version ~5.5
illuminate/support Version ~5.5
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 mayoz/laravel-tokens contains the following files

Loading the files please wait ....