PHPackages                             devsrv/laravel-session-out - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. devsrv/laravel-session-out

AbandonedArchivedLibrary[Authentication &amp; Authorization](/categories/authentication)

devsrv/laravel-session-out
==========================

Notify the user via modal if session expired

v1.2.0(7y ago)57213[1 issues](https://github.com/devsrv/laravel-session-out/issues)MITPHPPHP ^7.1.3

Since Oct 20Pushed 7y agoCompare

[ Source](https://github.com/devsrv/laravel-session-out)[ Packagist](https://packagist.org/packages/devsrv/laravel-session-out)[ Docs](https://github.com/devsrv/laravel-session-out)[ RSS](/packages/devsrv-laravel-session-out/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

Session expired message for your Laravel application
====================================================

[](#session-expired-message-for-your-laravel-application)

[![Latest Version on Packagist](https://camo.githubusercontent.com/724a5b51a1f7a596ee48f37e5c9351bfdd7dbc3d427ce03e57262c9549fe63e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465767372762f6c61726176656c2d73657373696f6e2d6f75742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devsrv/laravel-session-out)[![GitHub license](https://camo.githubusercontent.com/25651ddcc5110d0e6be3a0f44f48dc8478f2de59638b961361cc746a25451fd0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6465767372762f6c61726176656c2d73657373696f6e2d6f75742e7376673f7374796c653d666c61742d737175617265)](https://github.com/devsrv/laravel-session-out/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/c4e5cff957bd3a2656aa04d8045cd79d95a8b114d7f1493956a65d99b4caebf4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465767372762f6c61726176656c2d73657373696f6e2d6f75742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devsrv/laravel-session-out)[![Laravel Support](https://camo.githubusercontent.com/675d222d88620a2d4160f074f188f2c33d768ea47b101ba8945c6f741c7bedfe/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e2a2d626c75652e7376673f6c6f6e6743616368653d74727565267374796c653d666c61742d737175617265)](#)[![GitHub issues](https://camo.githubusercontent.com/1cba84a64993016d211c142f5bb2920b066e449d25f6b5d55ef92568ac84990d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6465767372762f6c61726176656c2d73657373696f6e2d6f75742e7376673f7374796c653d666c61742d737175617265)](https://github.com/devsrv/laravel-session-out/issues)

If for any reason ***( user logged out intentionally / session lifetime expired / session flushed for all logged in devices of the user )*** the authentication session doesn't exist &amp; still the user is on a page or multiple pages which require the user to be logged in, then showing a message that

> authentication session no longer available &amp; to continue your current activity *( may be in the middle of posting an unsaved post etc. )*, you are advised to login again

and right after user logged in then hiding the message is all about this package.

📥 Installation
--------------

[](#--installation)

You can install the package via composer:

```
composer require devsrv/laravel-session-out
```

> Laravel 5.5+ users: this step may be skipped, as we can auto-register the package with the framework.

```
// Add the ServiceProvider to the providers array in
// config/app.php

'providers' => [
    '...',
    'devsrv\sessionout\sessionExpiredServiceProvider::class',
];
```

You need to publish the `blade`, `js`, `css` and `config` files included in the package using the following artisan command:

```
php artisan vendor:publish --provider="devsrv\sessionout\sessionExpiredServiceProvider"
```

⚗️ Usage
--------

[](#️-usage)

just include the blade file to all the blade views which are only available to authenticated users.

```
@include('vendor.sessionout.notify')
```

> rather copying this line over &amp; over to the views, extend your base blade view and include it there in the bottom

🛠 Configuration
---------------

[](#--configuration)

#### ✔ The Config File

[](#-the-config-file)

publishing the vendor will create `config/expiredsession.php` file

```
return [
	// the number of seconds between ajax hits to check auth session
    'gap_seconds' => 30,

    // whether using broadcasting feature to make the modal disappear faster
    'avail_broadcasting' => false,
```

#### ✔ If you want to take advantage of broadcasting

[](#-if-you-want-to-take-advantage-of-broadcasting)

> \*\* if you are using `avail_broadcasting = true` i.e. want to use the Laravel Echo for faster output please follow the below steps

1. setup [broadcasting](https://laravel.com/docs/master/broadcasting) for your app and start `usersession` queue worker

```
php artisan queue:work --queue=default,usersession
```

2. make sure to put the broadcasting client config `js` file above the `@include` line not below it, in your blade view.

```

//some html between
@include('vendor.sessionout.notify')
```

3. in `App\Providers\BroadcastServiceProvider` file in the `boot` method require the package's channel file, it contains private channel authentication

```
require base_path('vendor/devsrv/laravel-session-out/src/routes/channels.php');
```

4. in all the places from where users are authenticated call `devsrv\sessionout\classes\AuthState::sessionAvailable()` . if you are using custom logic to login users then put the line inside your authentication method when login is successful.

> if you are using laravel's default authentication system then better choice will be to create a listener of the login event, Example :-

```
// App\Providers\EventServiceProvider

protected $listen = [
        'Illuminate\Auth\Events\Login' => [
            'App\Listeners\SuccessfulLogin',
        ],
    ];
```

```
// App\Listeners\SuccessfulLogin

use devsrv\sessionout\classes\AuthState;

/**
* Handle the event.
*
* @param  Login  $event
* @return void
*/
public function handle(Login $user)
{
	AuthState::sessionAvailable();
}
```

#### ✔ Update the modal design &amp; contents

[](#-update-the-modal-design--contents)

The modal is created with pure `js` and `css` no framework has been used, so you can easily customize the modal contents by editing the `views/vendor/sessionout/modal.blade.php` &amp; the design by editing `public/vendor/sessionout/css/session-modal.css`

#### ✔ Advanced

[](#-advanced)

- 🔘 if you want to customize the `js` file which is responsible for checking auth session &amp; modal display then modify the `public/vendor/sessionout/js/main.js` file but don't forget to compile it with webpack &amp; place the compiled `js` as `public/vendor/sessionout/dist/js/main.js`
- 🔘 **you may want to create a login form** in the modal, first create the html form in the `views/vendor/sessionout/modal.blade.php` then put the ajax code in `public/vendor/sessionout/js/main.js` &amp; don't forget to compile as mentioned above,

> after ajax success close the modal by calling the `closeSessionOutModal()` function

🧐📑 Note
-------

[](#-note)

#### ♻ When updating the package

[](#-when-updating-the-package)

Remember to publish the `assets`, `views` and `config` after each update

use `--force` tag after updating the package to publish the **updated latest** package `assets`, `views` and `config`

> but remember using *--force* tag will replace all the publishable files

```
php artisan vendor:publish --provider="devsrv\sessionout\sessionExpiredServiceProvider" --force

php artisan vendor:publish --provider="devsrv\sessionout\sessionExpiredServiceProvider" --tag=public --force
```

> when updating the package take backup of the `config/expiredsession.php` file &amp; `public/vendor/sessionout`, `views/vendor/sessionout` directories as the files inside these dir. are configurable so if you modify the files then the updated published files will not contain the changes, though after publishing the `assets`, `views` and `config` you may again modify the files

#### 🔧 After you tweak things

[](#-after-you-tweak-things)

Run this artisan command after changing the config file.

```
php artisan config:clear
php artisan queue:restart // only when using broadcasting
```

👋🏼 Say Hi!
----------

[](#-say-hi)

Let me know in [Twitter](https://twitter.com/srvrksh) | [Facebook](https://www.facebook.com/srvrksh) if you find this package useful 👍🏼

🎀 License
---------

[](#-license)

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

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

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 ~4 days

Total

4

Last Release

2744d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26733312?v=4)[Sourav Rakshit](/maintainers/devsrv)[@devsrv](https://github.com/devsrv)

---

Top Contributors

[![devsrv](https://avatars.githubusercontent.com/u/26733312?v=4)](https://github.com/devsrv "devsrv (26 commits)")

---

Tags

laravellaravel-5-packagesession-expirationlaravel suggest login againlaravel expired session message

### Embed Badge

![Health badge](/badges/devsrv-laravel-session-out/health.svg)

```
[![Health](https://phpackages.com/badges/devsrv-laravel-session-out/health.svg)](https://phpackages.com/packages/devsrv-laravel-session-out)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[olssonm/l5-very-basic-auth

Laravel stateless HTTP basic auth without the need for a database

1662.5M1](/packages/olssonm-l5-very-basic-auth)[stechstudio/laravel-jwt

Helper package that makes it easy to generate, consume, and protect routes with JWT tokens in Laravel

126117.6k](/packages/stechstudio-laravel-jwt)[scaler-tech/laravel-saml2

SAML2 Service Provider integration for Laravel applications, based on OneLogin toolkit

2737.5k](/packages/scaler-tech-laravel-saml2)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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