PHPackages                             fraank/view-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. fraank/view-counter

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

fraank/view-counter
===================

A view and like counter extension for your laravel project.

4.x-dev(11y ago)165267[4 issues](https://github.com/fraank/ViewCounter/issues)PHPPHP &gt;=5.4.0

Since Feb 17Pushed 10y ago2 watchersCompare

[ Source](https://github.com/fraank/ViewCounter)[ Packagist](https://packagist.org/packages/fraank/view-counter)[ RSS](/packages/fraank-view-counter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Laravel ViewCounter
===================

[](#laravel-viewcounter)

A view and like counter extension for your laravel project. It uses session storage if the user is not logged in and keeps it clean while the session is active (no double likes or views). If a user is logged in, the information about hthe likes and views are stored into the database for getting history.

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

[](#installation)

Install using composer:

```
composer require fraank/view-counter
```

While the package is not stable, please make sure you added it as dev: Open "composer.json" manually and add "fraank/view-counter": "dev-master" into require.

Add the service provider in `app/config/app.php`:

```
Fraank\ViewCounter\ViewCounterServiceProvider::class,
```

The service provider will register an interface for your models to use view\_counter and like\_couter functionality.

To create the basic tables you have to provide the migation files:

```
php artisan vendor:publish
```

Now you can migrate:

```
php artisan migrate
```

Now you can register the like and view functionality in your model:

```
class Object extends Eloquent {
  use Fraank\ViewCounter\ViewCounterTrait;
}
```

You can call the actions for like and unlike in your views (or controllers) like this:

```
{{ route('view_counter.like', array('class_name' => 'post', 'object_id' => $post->id)) }}
{{ route('view_counter.unlike', array('class_name' => 'post', 'object_id' => $post->id)) }}
```

Examples
--------

[](#examples)

### Basic Usage

[](#basic-usage)

\*\*Increment a ViewCounter in a Controller (show action)

```
$object->view();
```

\*\*Get count of Views

```
$object->views_count();
```

\*\*Did the user viewed the object?

```
$object->isViewed();
```

\*\*Increment the LikeCounter in a Controller (show action)

```
$object->like();
```

\*\*Unlike

```
$object->unlike();
```

\*\*Get count of Likes

```
$object->likes_count();
```

\*\*Did the user liked the object?

```
$object->isLiked();
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

4106d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/65721b830c12b200b31db9abfadef70fccf1feb18ac62312931c420d727e20bf?d=identicon)[fraank](/maintainers/fraank)

---

Top Contributors

[![fraank](https://avatars.githubusercontent.com/u/32003?v=4)](https://github.com/fraank "fraank (13 commits)")

### Embed Badge

![Health badge](/badges/fraank-view-counter/health.svg)

```
[![Health](https://phpackages.com/badges/fraank-view-counter/health.svg)](https://phpackages.com/packages/fraank-view-counter)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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