2017 © Pedro Peláez
 

library laravel-survivor

Doesn't let your tokens expire

image

influendo/laravel-survivor

Doesn't let your tokens expire

  • Friday, January 5, 2018
  • by bstrahija
  • Repository
  • 4 Watchers
  • 15 Stars
  • 21,390 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 5 Versions
  • 18 % Grown

The README.md

Laravel Survivor

This library solves the problem if you have a site open and the you're gone from your device for some time. In this case the CSRF token used on your forms expires, and you get an Exception., (*1)

The purpose of this library is to keep the session from expiring, but also to keep the tokens up to date throughout your application., (*2)

Installation (Laravel 5.2 is required)

  1. Install via composer, (*3)

    composer require influendo/laravel-survivor, (*4)

  2. Add the script to your view. You can also add it to your footer.blade.php partial or your main layout file (by your own preference):, (*5)

    {!! survivor() !!}, (*6)

Laravel 5.4 or older

If you're running Laravel 5.4 or older, you need to manually register the service provider. So just add the service provider to your config\app.php file:, (*7)

Influendo\LaravelSurvivor\SurvivorServiceProvider::class,

Configuration

To configure the library you just need to publish the default vendor configuration:, (*8)

php artisan vendor:publish --tag=survivor

You can change the interval in miliseconds, the path for ping route and the query selector for input elements which will be updated when a token expires., (*9)

Funcionality

First of all the library pings a custom created endpoint in a predefined interval to keep your session up to date. When the CSRF token expires, the endpoint returns a new token, and the script then updates all the input fields named "_token" and a meta tag named "csrf-token"., (*10)

If your using any 3rd party scripts, you can fetch the valid token at any time from the window.LaravelSurvivor.token object., (*11)

The Versions

05/01 2018

dev-master

9999999-dev

Doesn't let your tokens expire

  Sources   Download

MIT

The Requires

 

The Development Requires

by Influendo

05/01 2018

dev-develop

dev-develop

Doesn't let your tokens expire

  Sources   Download

MIT

The Requires

 

The Development Requires

by Influendo

05/01 2018

1.0.1

1.0.1.0

Doesn't let your tokens expire

  Sources   Download

MIT

The Requires

 

The Development Requires

by Influendo

22/03 2016

1.0.0

1.0.0.0

Doesn't let your tokens expire

  Sources   Download

MIT

The Requires

 

The Development Requires

by Influendo

02/03 2016

0.1.0

0.1.0.0

Doesn't let your tokens expire

  Sources   Download

MIT

The Requires

 

The Development Requires

by Influendo