PHPackages                             dinhdjj/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. dinhdjj/visit

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

dinhdjj/visit
=============

Package to tracking visits of a given model

v1.1.1(3y ago)0367[3 PRs](https://github.com/dileedotdev/laravel-visit/pulls)MITPHPPHP ^8.1

Since Aug 18Pushed 2y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (14)Versions (7)Used By (0)

Package to tracking visits of a given model
===========================================

[](#package-to-tracking-visits-of-a-given-model)

[![Latest Version on Packagist](https://camo.githubusercontent.com/831209b003252ca551de7f9a782f383fb4064c8c8ceaf589e8d86f0403d451f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64696e68646a6a2f76697369742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dinhdjj/visit)[![GitHub Tests Action Status](https://camo.githubusercontent.com/68ef2ebebd8aeb717fb74190d681baf5f37f199713eef406ddf2275b2aa69ade/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f64696e68646a6a2f76697369742f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/dinhdjj/visit/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/01ce743e6dba06728de61fa993983c316abd04cfd070b868a123012fdadad1d6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f64696e68646a6a2f76697369742f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/dinhdjj/visit/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1ae84cd385ff54bac082b3313ce6311643a5cc0cc9b639b72860c0280e71a876/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64696e68646a6a2f76697369742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dinhdjj/visit)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

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

[](#installation)

You can install the package via composer:

```
composer require dinhdjj/laravel-visit
```

You can publish and run the migrations with:

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

You can publish the config file with:

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

This is the contents of the published config file:

```
// config for dinhdjj/laravel-visit package
return [

    /**
     * Table name for visit logs
     */
    'table' => 'visits',

    /**
     * The model class name that will be used to store visit logs, must be a subclass of \Dinhdjj\Visit\Models\Visit
     */
    'model' => Dinhdjj\Visit\Models\Visit::class,
];
```

Usage
-----

[](#usage)

### Use `Visitable` trait

[](#use-visitable-trait)

The first thing you need to do is, to use `Visitable` trait.

```
class Post extends Model
{
    use \Dinhdjj\Visit\Traits\Visitable;
}
```

After that, you can use below methods to interact with the visit logs:

```
    $post = Post::first();

    $post->visitLogs() // relation to visit logs

    $post->visitLogs // collection of visit logs

    $builder = $post->visitLog(User::first()) // builder visit with user as visitor

    $builder->byIp(); // prevent duplicate visit by ip
    $builder->byVisitor(); // prevent duplicate visit by visitor

    $builder->interval(60*15) // prevent duplicate visit within 15 minutes, default is 60*15

    $visit = $builder->log(); // create visit to database
```

### Use `Visitor` trait

[](#use-visitor-trait)

The first thing you need to do is, to use `Visitor` trait.

```
class User extends Model
{
    use \Dinhdjj\Visit\Traits\Visitor;
}
```

After that, you can use below methods to interact with the visit logs:

```
    $user = Post::first();

    $user->visits() // relation to visit logs

    $post->visits // collection of visit logs

    $builder = $post->visit(Post::first()) // builder visit to post

    // ... same as above
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/dinhdjj/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [dinhdjj](https://github.com/dinhdjj)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~115 days

Total

3

Last Release

1132d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/47e2161449a748d8324f83eca75917aac149ae95ced37796d72a1da71be7df90?d=identicon)[dileedotdev](/maintainers/dileedotdev)

---

Top Contributors

[![dinwwwh](https://avatars.githubusercontent.com/u/64189902?v=4)](https://github.com/dinwwwh "dinwwwh (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")

---

Tags

laraveltrackingvisitorvisitlaravisitdinhdjj

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/dinhdjj-visit/health.svg)

```
[![Health](https://phpackages.com/badges/dinhdjj-visit/health.svg)](https://phpackages.com/packages/dinhdjj-visit)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
