PHPackages                             seyamms/laravel-visit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. seyamms/laravel-visit

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

seyamms/laravel-visit
=====================

Laravel package for counting model visits

v1.0.1(1y ago)06MITPHPPHP ^8.1|^8.2|^8.3

Since May 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/SeyamMs/laravel-visit)[ Packagist](https://packagist.org/packages/seyamms/laravel-visit)[ Docs](https://github.com/seyamms/laravel-visit)[ GitHub Sponsors](https://github.com/SeyamMs)[ RSS](/packages/seyamms-laravel-visit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (3)Used By (0)

Laravel package for counting model visits
=========================================

[](#laravel-package-for-counting-model-visits)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9424f2fc138d1f0f78093e4f16a1948ff1d61deab18bdd2ba18493601905d8a8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736579616d6d732f6c61726176656c2d76697369742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/seyamms/laravel-visit)[![GitHub Tests Action Status](https://camo.githubusercontent.com/6cfd5435561552d03737f2e3200ce1ee04de927dff16783ad9c2ffbf474cef79/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736579616d6d732f6c61726176656c2d76697369742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/seyamms/laravel-visit/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/9fa3f82cd17bea1d2038e387ff45eae18bf52bd85a23cb1e381ed59a65fce8af/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736579616d6d732f6c61726176656c2d76697369742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/seyamms/laravel-visit/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/9d100be3675b678fe2b3d539167879b049fb46537c9cc6be4d9b4b96082001ef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736579616d6d732f6c61726176656c2d76697369742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/seyamms/laravel-visit)

This package is intended to count visits of model records with some sort of uniqueness factors (see the config file).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require seyamms/laravel-visit
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="laravel-visit-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-visit-config"
```

After publishing the config you will have visit.php in your config directory the contains these options:

```
/**
 * available factors are:
 * ['ip_address', 'platform', 'device', 'browser', 'language']
 * default: ['ip_address', 'platform']
 */
'factors' => [
    'ip_address',
    'platform',
    // 'device',
    // 'browser',
    // 'language',
],

// this accepts a valid carbon interval.
// 1 day, 2 days, 1 week, 2 months ...etc
// default: 1 day
'span' => '1 day',
```

Usage
-----

[](#usage)

just add Visitable trait to your model

```
