• Reading time ~ 1 min
  • 08.10.2023

The Browser Sessions Laravel package by Chris Mellor enables users to manage and monitor their active browser sessions. Using this package, you can see user sessions that are active on other devices and provides options to terminate unrecognized or all sessions, enhancing account security:

use Cjmellor\BrowserSessions\Facades\BrowserSessions;

// Retrieve a user's Current Sessions
BrowserSessions::sessions();
/*
[
  {
    "device": {
      "browser": "Safari",
      "desktop": true,
      "mobile": false,
      "platform": "OS X"
    },
    "ip_address": "127.0.0.1",
    "is_current_device": true,
    "last_active": "1 second ago"
  }
]
*/

You can even log the user out of all other browser sessions besides their current session with:

BrowserSessions::logoutOtherBrowserSessions();

Lastly, you can get the user's last activity with this method:

BrowserSessions::getUserLastActivity();
// or
BrowserSessions::getUserLastActivity(human: true);

To get started with this package, you can find all the installation details on Github at cjmellor/browser-sessions

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297