2017 © Pedro Peláez
 

library laravel-tokens-manager

An easy to use tokens manager for Laravel applications. Useful in user email confirmation process and not only.

image

lachezargrigorov/laravel-tokens-manager

An easy to use tokens manager for Laravel applications. Useful in user email confirmation process and not only.

  • Sunday, October 15, 2017
  • by lachezargrigorov
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 50 % Grown

The README.md

Tokens manager for Laravel.

Latest Stable Version Latest Unstable Version Software License Build Status Total Downloads, (*1)

An easy to use tokens manager for Laravel applications. Useful in user email confirmation process and not only., (*2)

Installation

Via Composer, (*3)

``` bash $ composer require lachezargrigorov\laravel-tokens-manager, (*4)


If you do not run Laravel 5.5 (or higher), then add the service provider in config/app.php: ```php \Lachezargrigorov\TokensManager\TokensManagerServiceProvider::class,

If you do not run Laravel 5.5 and want to use the facade, add this to your aliases in app.php:, (*5)

'Tokens' => \Lachezargrigorov\TokensManager\Facades\TokensManager::class,

Usage

``` php //using Facades, (*6)

//1. Create token with payload $token = Tokens::use('default')->create(['userId' => 123]);, (*7)

//2. Send confirmation url with created token to user per email., (*8)

//3. User click on confirmation url., (*9)

//4.Get the token's payload from the token in the url. //This will delete the token! $payload = Tokens::use('default')->get($token);, (*10)

//if token exist and not expired if($payload) { $userId = $payload["userId"];, (*11)

//confirm user email

}, (*12)

//using IOC, (*13)

$tokensManager = app("tokens-manager");, (*14)

$token = $tokensManager->use('default')->create(['userId' => 123]);, (*15)

$payload = $tokensManager->use('default')->get($token);, (*16)


Get payload without deleting the token ``` php $payload = Tokens::use('default')->get($token,false);

Token not found ``` php $payload = Tokens::use('default')->get($token); //null, (*17)


**Expired tokens are deleted automatically on every Tokens::use call for all managers so you can't receive the payload of expired token and you don't need to delete them manually too!** If you still wants to delete a token ``` php $payload = Tokens::use('default')->delete($token);

Testing

bash $ composer test, (*18)

Changelog

Please see CHANGELOG for more information on what has changed recently., (*19)

Contributing

Please see CONTRIBUTING , ISSUE_TEMPLATE and PULL_REQUEST_TEMPLATE for details., (*20)

Security

If you discover any security related issues, please email lachezar@grigorov.website instead of using the issue tracker., (*21)

Credits

License

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

The Versions

15/10 2017

dev-master

9999999-dev https://github.com/lachezargrigorov/laravel-tokens-manager

An easy to use tokens manager for Laravel applications. Useful in user email confirmation process and not only.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel tokens email validation lachezargrigorov

15/10 2017

v1.0.1

1.0.1.0 https://github.com/lachezargrigorov/laravel-tokens-manager

An easy to use tokens manager for Laravel applications. Useful in user email confirmation process and not only.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel tokens email validation lachezargrigorov

15/10 2017

v1.0.0

1.0.0.0 https://github.com/lachezargrigorov/laravel-tokens-manager

An easy to use tokens manager for Laravel applications. Useful in user email confirmation process and not only.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel tokens email validation lachezargrigorov