PHPackages                             voidgraphics/laravel-pageview-counter - 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. voidgraphics/laravel-pageview-counter

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

voidgraphics/laravel-pageview-counter
=====================================

A stupid simple analytics tool to keep track of page views

v0.1.0(1y ago)2251PHP

Since Jul 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/voidgraphics/laravel-pageview-counter)[ Packagist](https://packagist.org/packages/voidgraphics/laravel-pageview-counter)[ RSS](/packages/voidgraphics-laravel-pageview-counter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

laravel-pageview-counter
========================

[](#laravel-pageview-counter)

A stupid simple analytics tool to keep track of page views in Laravel projects. It logs requests to a database table and you can access the data with an Eloquent model.

Based on [this article](https://medium.com/@bastiaanrudolf/a-rudimental-approach-to-web-analytics-with-laravel-818296a70cd0) by Bastiaan Rudolf.

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

[](#installation)

```
composer require voidgraphics/laravel-pageview-counter
```

You need to publish the migration that will add the pageviews table:

```
php artisan vendor:publish --tag=pageview-counter-migrations
```

Then run the migrations

```
php artisan migrate
```

After this, register the `LogRequest` middleware. You can do it globally or on specific routes. Here's how to install it globally in Laravel 11

```
// bootstrap/app.php
