PHP Classes

PHP Artisan Auth Laravel 5: Laravel service provider to track visitors

Recommend this page to a friend!
  Info   View files Example   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 67 This week: 1All time: 10,307 This week: 560Up
Version License PHP version Categories
laravel-5-url-auth 1.0Custom (specified...5PHP 5, User Management, Libraries
Description 

Author

This package is a Laravel service provider to track visitors.

It is a service provider that tracks users accessing a given URL and other pages that the user may visit.

The package can redirect the visitor to another page that the user wants to visit, as well keep track of the count of how many times users are visiting that page.

The redirection may happen for a given period of limited time. After that time, the user is redirected to the login page.

Innovation Award
PHP Programming Innovation award nominee
July 2018
Number 7
Many sites only provide access to certain pages to users that are authorized to access it.

This package provides a solution as Laravel framework service that keeps track of the visitors that want to access a given page for a limited period of time.

Manuel Lemos
Picture of Wedmak
  Performance   Level  
Name: Wedmak <contact>
Classes: 2 packages by
Country: Russian Federation Russian Federation
Age: ???
All time rank: 4377123 in Russian Federation Russian Federation
Week rank: 411 Up22 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 2x

Example

<?php

\Route::get('/urlauth/{urlauthtoken}',
    function (
$urlauthtoken)
    {
       
$record=\iWedmak\UrlAuth\UrlAuth::where('token', $urlauthtoken)
        ->
where('lifetime', '>', \Carbon\Carbon::now())
        ->
first();
        if(
$record)
        {
           
$record->increment('visits');
            \
Auth::loginUsingId($record['user_id'], true);
            \
Event::fire(new \iWedmak\UrlAuth\Events\UrlVisit($record));
            return
redirect($record['url']);
        }
       
$throw=\Config::get('urlauth.exception');
       
pre($throw);
        throw new
$throw('no token');
    }
)->
name('urlAuth')->middleware('web');


Details

laravel-5-url-auth

Mostly for use in emails, so user can click url and get redirected with authentication. Url in email have lifetime, in hours. Monitors url visits reads, have event UrlVisit. * install

composer require iwedmak/url-auth
  • Or
    php composer.phar require iwedmak/url-auth
    
  • Or add to composer.json
    "iwedmak/url-auth": "*"
    

Register provider, add this to config/app.php in providers array:

iWedmak\UrlAuth\UrlAuthServiceProvider::class,

After that u will need to publish config

php artisan vendor:publish

and publish migrations and migrate

php artisan urlauth:migration
php artisan migrate

Now you can user urlauth($user_id, $url) function in your blade template(or anywhere), like this:

{{urlauth($user['id'], route('some.route'))}}

You can listen for \iWedmak\UrlAuth\Events\UrlVisit event. in EventServiceProvider.php

protected $listen = [
    '\iWedmak\UrlAuth\Events\UrlVisit' => [
        'App\Listeners\SomeListener',
    ],
];


  Files folder image Files  
File Role Description
Files folder imagesrc (4 files, 4 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imagecommands (1 file)
Files folder imageconfig (1 file)
Files folder imageEvents (1 file)
Files folder imageviews (1 directory)
  Accessible without login Plain text file helper.php Aux. Auxiliary script
  Accessible without login Plain text file routes.php Example Example script
  Plain text file UrlAuth.php Class Class source
  Plain text file UrlAuthServiceProvider.php Class Class source

  Files folder image Files  /  src  /  commands  
File Role Description
  Plain text file MigrationCommand.php Class Class source

  Files folder image Files  /  src  /  config  
File Role Description
  Accessible without login Plain text file config.php Aux. Auxiliary script

  Files folder image Files  /  src  /  Events  
File Role Description
  Plain text file UrlVisit.php Class Class source

  Files folder image Files  /  src  /  views  
File Role Description
Files folder imagegenerators (1 file)

  Files folder image Files  /  src  /  views  /  generators  
File Role Description
  Accessible without login Plain text file migration.blade.php Aux. Auxiliary script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:67
This week:1
All time:10,307
This week:560Up