PHPackages                             petercoles/live-or-let-die - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. petercoles/live-or-let-die

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

petercoles/live-or-let-die
==========================

Synchronising Laravel session management with your frontend

1.3.1(9y ago)3160MITPHPPHP &gt;=5.6.0

Since Mar 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/petercoles/Live-Or-Let-Die)[ Packagist](https://packagist.org/packages/petercoles/live-or-let-die)[ Docs](https://github.com/petercoles/live-or-let-die)[ RSS](/packages/petercoles-live-or-let-die/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (5)Versions (9)Used By (0)

Live or Let Die for Laravel
===========================

[](#live-or-let-die-for-laravel)

[![SensioLabsInsight](https://camo.githubusercontent.com/d8a7a1b702f68118d3d9af204549217dd03b05a15f653d863589957b7a636eb7/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f62383636316364612d646663632d346361312d383037642d3733663865373866313166642f6d696e692e706e67)](https://insight.sensiolabs.com/projects/b8661cda-dfcc-4ca1-807d-73f8e78f11fd)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/10270508a5a3cc7a29b31a05deb80318c2b07642f61f55d58b2227aa98a28cd3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7065746572636f6c65732f4c6976652d4f722d4c65742d4469652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/petercoles/Live-Or-Let-Die/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/fd912bd503efda56e12a00cc3ec41b501354f51d499f156521113b545dd36c28/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7065746572636f6c65732f4c6976652d4f722d4c65742d4469652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/petercoles/Live-Or-Let-Die/?branch=master)[![Build Status](https://camo.githubusercontent.com/41675cf7ab687b7caad7a6c8a3fab3afb4fa6dba5b3b4016c9e2255ce7bfd22f/68747470733a2f2f7472617669732d63692e6f72672f7065746572636f6c65732f4c6976652d4f722d4c65742d4469652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/petercoles/Live-Or-Let-Die)[![License](https://camo.githubusercontent.com/e498eead712d82d9ee1af0a4850acd2e46ea48c48fb9ce5a3d2ab64f28f95b34/687474703a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6d69742d626c75652e737667)](http://doge.mit-license.org)

Introduction
------------

[](#introduction)

As we build sites with more-and-more features executed and managed directly in the user's browser, the connection between browser and server becomes increasingly strained. While our users are beavering away in their browsers, we risk our server-side Laravel application quietly terminating the associated sessions, logging them out and causing ajax-powered actions to fail unexpectedly and in ways that are inexplicable and difficult to understand for our users.

One way to address this is to lengthen our sessions. But even ignoring the security implications of this, it merely mitigates the problem; it doesn't solve it.

This package extends Laravel by injecting three routes that can be used by frontend applications to work with remote Laravel sessions. They can be used to see for how much longer an authentication session will last, and to extend or end it in response to browser-based actions that might otherwise go unnoticed by our server.

Installation
------------

[](#installation)

At the command line run

```
composer require petercoles/live-or-let-die

```

then add the service provider to the providers entry in your config/app.php file

```
    'providers' => [
        // ...
        PeterColes\LiveOrLetDie\Providers\LiveOrLetDieServiceProvider::class,
        // ...
    ],

```

the middleware, "\\PeterColes\\LiveOrLetDie\\Middleware\\SessionTimeout::class", will be added automatically to the web routes group and will be applied to all routes that it contains. If you use a different group for your ajax requests, then it may be added to that group in your app/Http/Kernal.php file, or wherever you have defined it. For example:

```
    protected $middlewareGroups = [
        'myMiddleware' => [
            ...
            \PeterColes\LiveOrLetDie\Middleware\SessionTimeout::class,
        ],
    ];

```

However, this middleware should not be included for stateless requests, e.g. API calls.

Configuration
-------------

[](#configuration)

If, and only if, your auth routes are called something other than 'login', 'register' and 'logout', then publish the config file and put your routes in there. Publishing is done by executing the following artisan command in your terminal.

```
php artisan vendor:publish --provider="PeterColes\LiveOrLetDie\Providers\LiveOrLetDieServiceProvider"

```

Usage
-----

[](#usage)

This package makes available three routes designed for use by ajax calls to enable frontend applications to work with remote Laravel sessions:

- `session/remaining` returns the number of seconds remaining in the current session, without affecting time remaining
- `session/ping` can be used to extend the session length for events that might not otherwise be notified to the remote server, e.g. clicking on javascript managed tabs
- `session/end` allows the frontend to request termination of the remote session.

These routes are injected automatically - there's no need for you to add them to your routes file.

Issues
------

[](#issues)

This package was developed to meet a specific need and then generalised for wider use. If you have a use case not currently met, or see something that appears to not be working correctly, please raise an issue at the [github repo](https://github.com/petercoles/Live-Or-Let-Die/issues)

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability within this package, please send an e-mail to me at . I take security very seriously and any security vulnerabilities will be addressed promptly.

License
-------

[](#license)

This package is licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~56 days

Recently: every ~96 days

Total

8

Last Release

3351d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2947594?v=4)[Peter Coles](/maintainers/petercoles)[@petercoles](https://github.com/petercoles)

---

Top Contributors

[![petercoles](https://avatars.githubusercontent.com/u/2947594?v=4)](https://github.com/petercoles "petercoles (43 commits)")

---

Tags

laravelsessions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/petercoles-live-or-let-die/health.svg)

```
[![Health](https://phpackages.com/badges/petercoles-live-or-let-die/health.svg)](https://phpackages.com/packages/petercoles-live-or-let-die)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M125](/packages/laravel-pulse)[anahkiasen/former

A powerful form builder

1.4k1.4M14](/packages/anahkiasen-former)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M123](/packages/roots-acorn)[illuminate/routing

The Illuminate Routing package.

1419.2M2.9k](/packages/illuminate-routing)[prologue/alerts

Prologue Alerts is a package that handles global site messages.

3486.4M37](/packages/prologue-alerts)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
