← Back to list

Introducing Durjay Views: A Simple Laravel View Counter Package

Tracking views in a Laravel application should be simple, flexible, and developer-friendly. That’s why I built Durjay Views a lightweight…

Durjay Ghosh · 2026-05-09 13:34 · 0 claps · 1.4 min read
#laravel-framework #laravel-packages #views #admin #durjaygp
Open on Medium ↗

Introducing Durjay Views: A Simple Laravel View Counter Package

Tracking views in a Laravel application should be simple, flexible, and developer-friendly. That’s why I built Durjay Views a lightweight Laravel package for counting views on blogs, products, services, or any model with minimal setup.

Whether you are building an eCommerce platform, blog website, SaaS dashboard, or portfolio project, this package helps you track page views easily while also giving you a clean statistics dashboard.

GitHub Repository: https://github.com/durjaygp/durjay-views

✨ Features

  • Simple Laravel view tracking
  • Track views using a helper function
  • Trait-based model integration
  • Supports Blogs, Products, Services, and custom entities
  • Stores everything in a single database table
  • Tailwind CSS statistics dashboard
  • Unique visitor tracking
  • 7-day views chart
  • Recent activity table
  • Easy customization

📦 Installation

Install the package via Composer:

composer require durjaygp/durjay-views

Publish migrations and views:

php artisan vendor:publish --provider="Durjaygp\DurjayViews\DurjayViewsServiceProvider"


Run migrations:

php artisan migrate


# 🚀 Usage

# Option 1: Using the Helper Function

You can track views instantly using a simple helper:

trackDurjayViews('product', $product->id);

trackDurjayViews('blog', $blog->id);


# Option 2: Using the `Viewable` Trait

If you prefer a cleaner model-based approach, use the included trait:

namespace App\Models;

use Illuminate\Database\Eloquent\Model; use Durjaygp\DurjayViews\Traits\Viewable;

class Product extends Model { use Viewable; }


Now record views directly:

$product->recordDurjayView();


Get total views:

echo $product->view_count;


# 📊 Beautiful Statistics Dashboard

Visit:

/durjay-views/stats


The dashboard includes:
- Today vs Yesterday statistics
- Total unique visitors
- Today's unique visitors
- 7-day interactive views chart
- Recent activity tracking
- Guest/User detection

You can also publish and customize the dashboard views:

php artisan vendor:publish --provider="Durjaygp\DurjayViews\DurjayViewsServiceProvider" --tag="views"



# 💡 Why I Built This

Most view counter solutions I found were either:
- Too complicated
- Required multiple tables
- Lacked dashboards
- Were difficult to integrate

So I decided to create something:
- Beginner-friendly
- Lightweight
- Modern-looking
- Easy to extend

🛠 Perfect For
- Blog platforms
- eCommerce stores
- Portfolio websites
- SaaS applications
- CMS systems
- Admin dashboards

# ⭐ GitHub Repository

👉 [https://github.com/durjaygp/durjay-views](https://github.com/durjaygp/durjay-views)

Feedback, issues, and contributions are always welcome.

메타데이터
post_id
6ef457ef400f
slug
introducing-durjay-views-a-simple-laravel-view-counter-package-6ef457ef400f
url
https://medium.com/@durjayghosh100/introducing-durjay-views-a-simple-laravel-view-counter-package-6ef457ef400f
canonical_url
https://medium.com/@durjayghosh100/introducing-durjay-views-a-simple-laravel-view-counter-package-6ef457ef400f
author_url
https://medium.com/@durjayghosh100
status
ok
fetched_at
2026-06-22 08:06:21