PHP code example of devsrv / laravel-session-out

1. Go to this page and download the library: Download devsrv/laravel-session-out library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

devsrv / laravel-session-out example snippets



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

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

@

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,

<script type="text/javascript" src="{{ asset('js/broadcasting.js') }}"></script>
//some html between
@



// 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();
}
bash
php artisan vendor:publish --provider="devsrv\sessionout\sessionExpiredServiceProvider"
bash
php artisan queue:work --queue=default,usersession
bash
php artisan vendor:publish --provider="devsrv\sessionout\sessionExpiredServiceProvider" --force

php artisan vendor:publish --provider="devsrv\sessionout\sessionExpiredServiceProvider" --tag=public --force
bash
php artisan config:clear
php artisan queue:restart // only when using broadcasting