PHPackages                             ahmedels/visitlog - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. ahmedels/visitlog

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

ahmedels/visitlog
=================

Laravel package to log visitor information into database.

1.3.6(5y ago)032MITPHPPHP &gt;=5.5.9

Since Jul 17Pushed 5y agoCompare

[ Source](https://github.com/AhmedEls/visitlog)[ Packagist](https://packagist.org/packages/ahmedels/visitlog)[ RSS](/packages/ahmedels-visitlog/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (13)Used By (0)

Laravel VisitLog
================

[](#laravel-visitlog)

[![Total Downloads](https://camo.githubusercontent.com/9301b2a65e40e5e30bb939475cf1d0a516e9c733593d29ad2ac343b265324f55/68747470733a2f2f706f7365722e707567782e6f72672f7361726672617a6e6177617a323030352f76697369746c6f672f646f776e6c6f616473)](https://packagist.org/packages/sarfraznawaz2005/visitlog)

Introduction
------------

[](#introduction)

VisitLog is a simple Laravel 5 package that can be used to log visitor information and save it into database.

Features
--------

[](#features)

- Other than basic log such as IP, Browser and OS, it can also log Location information.
- Allows to log both unique and non-unique visits based on IP.
- Allows to cache the visits based on IP.
- Allows to log authenticated user info.
- Provides log viewer page out of box.
- Provides basic http authentication for app users.
- Ability to ban users by their IP

**Note:** VisitLog cannot detect same user/IP coming from some anonymizer so it cannot differentiate that.

Screenshot
----------

[](#screenshot)

[![Main Window](https://camo.githubusercontent.com/635c924aed1980ae6b80a6a049eec8b72056f2b8954d1dd33d47defa1c7a66a5/68747470733a2f2f7261772e6769746875622e636f6d2f7361726672617a6e6177617a323030352f76697369746c6f672f6d61737465722f73637265656e2e706e67)](https://camo.githubusercontent.com/635c924aed1980ae6b80a6a049eec8b72056f2b8954d1dd33d47defa1c7a66a5/68747470733a2f2f7261772e6769746875622e636f6d2f7361726672617a6e6177617a323030352f76697369746c6f672f6d61737465722f73637265656e2e706e67)

*Note: Info in above screenshot is fake.*

Requirements
------------

[](#requirements)

- PHP &gt;= 5.5.9
- Laravel 5

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

[](#installation)

Install via composer

```
composer require sarfraznawaz2005/visitlog

```

For Laravel &lt; 5.5:

Add Service Provider to `config/app.php` in `providers` section

```
Sarfraznawaz2005\VisitLog\VisitLogServiceProvider::class,
```

Add Facade to `config/app.php` in `aliases` section

```
'VisitLog' => Sarfraznawaz2005\VisitLog\Facades\VisitLog::class,
```

---

Run `php artisan vendor:publish` to publish package's config and migration file. You should now have `config/visitlog.php` file published. It will also publish migration file in `database/migrations` folder.

Run `php artisan migrate` to create `visitlogs` table in your database.

Config Options
--------------

[](#config-options)

- `route` : Route where visit log will be available.
- `iptolocation` : By default, only IP, Browser and OS info is logged. However if you set this option to `true`, it will also log Location info through  service. Note: You will need to create account there and get your access key and specify that in visitlog config file.
- `cache` : If `iptolocation` is set to `true`, this option can be used to cache the results instead of requesting Location info each time from .
- `unique` : If `true`, it will only log unique visits based on IP address. If `false`, it will log each visit even from same IP.
- `log_user` : If `true`, it will also log authenticated user info.
- `user_name_fields` : If `log_user` is `true`, this option can be used to specify name fields of user from your Users table in database.
- `visitlog_page` : If `true`, a default log viewer page can be viewed at `http//yourapp.com/your_route` to see all the logs. Here `your_route` is the first option above.
- `http_authentication` : If `visitlog_page` is `true`, this option can be used to show visit log page to only authenticated app users by asking them email and password via basic http authentication.

Saving Log Info
---------------

[](#saving-log-info)

To save logs, just call `save` method of `VisitLog` facade: `VisitLog::save();`

**Tip:** If you want to save only unique logs based on IP, login or post-login page is good place to use the `save` method on because generally login page isn't visited again after user is authenticated. If you also want to save authenticated user, calling `save` method inside login post method seems to be good idea.

If however, you have set `unique` option to `false` and want to log all visits, calling `save` method in common location is good idea like base controller of your app.

Viewing Log Info
----------------

[](#viewing-log-info)

If config option `visitlog_page` is set to `true`, you can view all visit logs by browsing to `http//yourapp.com/your_route`.

**Note:** If you don't want to allow `visitlog` page to be publicly seen, set the option `visitlog_page` to `false` and now `http//yourapp.com/your_route` will result in `404` error.

In this case, you can still show log info in some authenticated area of your app by using `all` method of `VisitLog` facade: `$visitLogs = VisitLog::all();` and it will give you `Collection` that you can iterate over and show in your own view file.

Credits
-------

[](#credits)

- [Sarfraz Ahmed](https://github.com/sarfraznawaz2005)
- [All Contributors](https://github.com/sarfraznawaz2005/visitlog/graphs/contributors)

License
-------

[](#license)

This code is published under the [MIT License](http://opensource.org/licenses/MIT). This means you can do almost anything with it, as long as the copyright notice and the accompanying license file is left intact.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 70.9% of commits — single point of failure

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 ~82 days

Recently: every ~67 days

Total

12

Last Release

1948d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ff1a3e2d28081ffe558364bc158e8877898d494e9947bdc785001498d1978ddd?d=identicon)[ahmedels](/maintainers/ahmedels)

---

Top Contributors

[![sarfraznawaz2005](https://avatars.githubusercontent.com/u/201788?v=4)](https://github.com/sarfraznawaz2005 "sarfraznawaz2005 (61 commits)")[![AhmedEls](https://avatars.githubusercontent.com/u/15481118?v=4)](https://github.com/AhmedEls "AhmedEls (9 commits)")[![jrb-armonya](https://avatars.githubusercontent.com/u/55982395?v=4)](https://github.com/jrb-armonya "jrb-armonya (8 commits)")[![sarfrazonsupport](https://avatars.githubusercontent.com/u/142378572?v=4)](https://github.com/sarfrazonsupport "sarfrazonsupport (4 commits)")[![djdino56](https://avatars.githubusercontent.com/u/14921188?v=4)](https://github.com/djdino56 "djdino56 (1 commits)")[![amirasaran](https://avatars.githubusercontent.com/u/6253691?v=4)](https://github.com/amirasaran "amirasaran (1 commits)")[![MinKyawNyunt](https://avatars.githubusercontent.com/u/26204153?v=4)](https://github.com/MinKyawNyunt "MinKyawNyunt (1 commits)")[![alexmayo](https://avatars.githubusercontent.com/u/21077557?v=4)](https://github.com/alexmayo "alexmayo (1 commits)")

---

Tags

loglaravelIPvisitor

### Embed Badge

![Health badge](/badges/ahmedels-visitlog/health.svg)

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

###  Alternatives

[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[sarfraznawaz2005/visitlog

Laravel package to log visitor information into database.

9015.9k](/packages/sarfraznawaz2005-visitlog)[larabug/larabug

Laravel 6.x/7.x/8.x/9.x/10.x/11.x/12.x/13.x bug notifier

299549.3k1](/packages/larabug-larabug)[jackiedo/log-reader

An easy log reader and management tool for Laravel

151376.5k4](/packages/jackiedo-log-reader)

PHPackages © 2026

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