Download the PHP package hardevine/laravel-session-tracker without Composer

On this page you can find all versions of the php package hardevine/laravel-session-tracker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-session-tracker

Laravel Session Tracker

This package provides session tracking functionalities, multisession management and user device management features for laravel applications.

Features

Installation (Laravel 5.x)

In composer.json:

"require": {
    "hardevine/laravel-session-tracker" "1.0.0"
}

Run:

composer update

Note: For v 5.5 Auto-discovery takes care.

Add the service provider to config/app.php under providers:

'providers' => [
    Hamedmehryar\SessionTracker\SessionTrackerServiceProvider::class,
]

Add the SessionTracker alias to config/app.php under aliases:

    'aliases' => [
        'SessionTracker' => 'Hamedmehryar\SessionTracker\SessionTrackerFacade',
    ]

Update config file to reference your login and logout route names:

config/sessionTracker.php

Migrate your database:

php artisan migrate

Add the trait to your user model:

use Hamedmehryar\SessionTracker\Traits\SessionTrackerUserTrait;

class User extends Model {
    use SessionTrackerUserTrait;
}

Add the DeviceCheck middleware in your kernel.php file:

protected $middleware = [
        'Hamedmehryar\SessionTracker\Middleware\DeviceCheck',
    ];

In Your routes.php file you should add 'session' middleware for routes which you want to keep track of:

Route::group(['middleware'=>'session'], function(){

    Route::get('your-route', 'YourController@yourAction');

});

Usage

From your user models:

$user->sessions(); //returns all the sessions of the user form the begining of usage of the package

$user->activeSessions(); //returns all currently active sessions for the user. (User may be logged in with same credentials from different devices)

$user->activeSessions(true); //return all active sessions for the user except the current session.

$user->getFreshestSession(); //Returns the most recent session of the user

$user->devices(); //Returns the collection of users saved trusted devices.

$user->devicesUids(); //Returns array of users saved trusted devices Ids.

From SessionTrackerFacade:

SessionTracker::startSession(); //Creates a new session for current user

SessionTracker::endSession(); //End the current session for the current user

SessionTracker::endSession(true); //End the current session for the current user and forgets the session

SessionTracker::renewSession(); //Restarts the ended session which is not forgotten for the current user. Usefull for restarting the session after locking it for inactivity

SessionTracker::refreshSession($request); //Keeps the session alive for each request. Useful in middleware

SessionTracker::logSession($request); //Logs the current request for the current session. (request logs stored in sessiontracker_session_requests table)

SessionTracker::isSessionInactive(); //Checks if the session is inactive. Determines the inactiveness by subtracting the **delay between last activity and current time** from the **inactivity_seconds** in sessionTracker config file.

SessionTracker::isSessionInactive($user); //Checks if the session for a specific user is inactive. Determines the inactiveness by subtracting the **delay between last activity and current time** from the **inactivity_seconds** in sessionTracker config file.

SessionTracker::blockSession($sessionId); //Blocks (ends and forgets) the current session for the user. (Useful if the user wants to controll all her sessions and block a specific session in a specific location)

SessionTracker::sessionRequests($sessionId); //Returns all requests done by a specific session

SessionTracker::isSessionBlocked(); //Checks if current user does not have an active session

SessionTracker::lockSessionByCode(); //Locks a session by a security code to be unlocked by that code and returns the code. (Usefull for two-step authentication implementation)

SessionTracker::securityCode(); //Returns the security code (hash) for the locked session.

SessionTracker::isSessionLocked(); //Checks if the current session is locked by a security code.

SessionTracker::unlockSessionByCode($code); //Unlocks the locked session by passing the security code. (returns -1 if the code is invalid, -2 if it's expired and 0 if success)

SessionTracker::isUserDevice(); //Returns true if the current device is trusted by the user

SessionTracker::deleteDevice($id); //Deletes a trusted device for the user

SessionTracker::addUserDevice(); //Add the current device as trusted by the user

SessionTracker::forgotSession(); //Checks if the session if forgotten

SessionTracker::sessionId(); //Returns the sessionId for the current session

SessionTracker::deleteSession(); //Deletes and forgets the current session

SessionTracker::refreshSecurityCode(); //Renews the security code by which the current session is locked

Author


All versions of laravel-session-tracker with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
laravel/framework Version >5.0
nesbot/carbon Version ~1.0 || ^2.0
jenssegers/agent Version ^2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hardevine/laravel-session-tracker contains the following files

Loading the files please wait ....