2017 © Pedro Peláez
 

library visitor-log

A package for Laravel 4 to log all visitors

image

cassiobueno90/visitor-log

A package for Laravel 4 to log all visitors

  • Wednesday, July 26, 2017
  • by cassiobueno90
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel 4 VisitorLog

A package for Laravel 4 to log all visitors, (*1)

If anyone has any ideas on how to make this framework agnostic, please contact me or open a pull request., (*2)

Installation

Add cassiobueno90/visitor-log as a requirement to composer.json:, (*3)

{
    ...
    "require": {
        ...
        "cassiobueno90/visitor-log": "dev-master"
        ...
    },
}

Update composer:, (*4)

$ php composer.phar update

Add the provider to your app/config/app.php:, (*5)

'providers' => array(

    ...
    'Cassiobueno90\VisitorLog\VisitorLogServiceProvider',

),

Add the alias to your app/config/app.php:, (*6)

'aliases' => array(

    ...
    'Visitor'         => 'Cassiobueno90\VisitorLog\Visitor',

),

Publish migration:, (*7)

$ php artisan migrate --package=cassiobueno90/visitor-log

(Optional) Publish package config:, (*8)

$ php artisan config:publish cassiobueno90/visitor-log

Configuration

  • onlinetime: The time (in minutes) while a visitor is still saved
  • usermodel: Set this to the Auth Provider you're using:
    • Laravel: Visitor-Log will try to get the User with Laravel's Auth Class
    • Sentry: Visitor-Log will try to get the User with Sentry
  • ignore: This is an array of pages that will be ignored by Visitor-Log. Example "admin/online"

The Visitor Class

The Visitor Class is an Eloquent Class but has a few extra methods, which will be explained here. * static isOnline($id): Will check whether the user with $id is online * static getCurrent(): Will get the current Visitor (based on their sid) * static clear(): Buggy!! This removes all old visitors from the Database. You normally don't need to call this as this happens on every request. * static loggedIn(): Will get all logged in Users * static guests(): Will get all guests * static findUser($id): Will get the User provided by $id (if online) * static findIp($ip): Will get all visitors with $ip * isUser(): Checks whether this visitor is a User * isGuest(): Checks whether this visitor is a Guest, (*9)

There are a few methods that wraps the specific Useragent method: * is_browser(): Checks whether this visitor uses a browser * is_robot(): Checks whether this visitor is a bot * is_mobile(): Checks whether this visitor uses a mobile client * is_referral(): Checks whether this visitor is a referral, (*10)

The Visitor Class also provides some attributes: * sid: A random String which is used to identicate the visitor * ip: The IP of the visitor * page: The Page where the visitor is * useragent: The useragent of the visitor * user: The UserID of the visitor * The timestamps (created_at, updated_at) * agent: Returns the useragent Instance used for this visitor * agents: Returns the modified Agentstring (eg Opera 12.16) * platform: Returns the operating System * browser: Returns the Browser which is used * version: Returns the Browser version which is used * robot: Returns the Botname which is browsing your site * mobile: Returns the mobile which is used * referrer: Returns the referrer, (*11)

What's with an "Who's online page"?

It's really easy to add one by yourself but Visitor-Log provides you already a very simple one: simply add @include("visitor-log::online") to your blade template where you want. And the best: It's ready to look nice with bootstrap, (*12)

The Versions

26/07 2017

dev-master

9999999-dev

A package for Laravel 4 to log all visitors

  Sources   Download

The Requires

 

by Avatar Jones
by Avatar uniacid
by Avatar cassiobueno90

laravel log sentry visitor

25/07 2017

v0.0.1.x-dev

0.0.1.9999999-dev

A package for Laravel 4 to log all visitors

  Sources   Download

The Requires

 

by Avatar Jones
by Avatar uniacid
by Avatar cassiobueno90

laravel log sentry visitor