PHPackages                             aabosham/laravel-comment - 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. aabosham/laravel-comment

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

aabosham/laravel-comment
========================

Just another comment system for your awesome Laravel project.

v1.0.1(3y ago)0109MITPHPPHP ^7.1.3|^8.0

Since Mar 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/AAbosham/laravel-comment)[ Packagist](https://packagist.org/packages/aabosham/laravel-comment)[ Docs](https://github.com/aabosham/laravel-comment)[ RSS](/packages/aabosham-laravel-comment/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Laravel Comment
===============

[](#laravel-comment)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c94ddd56390fdd0281d74bb1068b484dcd449f89dc6c7eb043c53e061fbfea70/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6161626f7368616d726176656c2d636f6d6d656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aaboshamravel-comment)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/9b08ccb13d33530f03ece11b863d7bcb515c9680eeb551f4c94362a51d1d64fa/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6161626f7368616d726176656c2d636f6d6d656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/aaboshamravel-comment)[![Total Downloads](https://camo.githubusercontent.com/cadea4effa85089523a0ffe40127a160c8ea088a849fa8c019413ccec5e414fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6161626f7368616d726176656c2d636f6d6d656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aaboshamravel-comment)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6ecc9278060b07b0049b876da9deef0fe39e64d9af10b7e18da241050e08684e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6161626f7368616d726176656c2d636f6d6d656e742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/aabaaboshamel-comment/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/c7e4207af08f635d31f317c8bba266b575bb26c003c7bbb3d964340dec2dc312/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6161626f7368616d726176656c2d636f6d6d656e742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/aabaaboshamel-comment/?branch=master)

Just another comment system for your awesome Laravel project.

Version Compatibility
---------------------

[](#version-compatibility)

LaravelLaravel Comment5.0.x0.1.x5.1.x0.1.x5.2.x0.1.x5.3.x0.2.x5.4.x0.3.xFor `>5.5` you can use `^1.0.0` version.

Install
-------

[](#install)

Via Composer

```
$ composer require aaboshamravel-comment
```

If you don't use auto-discovery, or using Laravel version &lt; 5.5 Add service provider to your app.php file

```
\Aabosham\LaravelComment\LaravelCommentServiceProvider::class
```

Publish configurations and migrations, then migrate comments table.

```
$ php artisan vendor:publish
$ php artisan migrate
```

Add `CanComment` trait to your User model.

```
use Aabosham\LaravelComment\CanComment;

class User extends Model
{
    use CanComment;

    // ...
}
```

Add `Commentable` interface and `HasComments` trait to your commentable model(s).

```
use Aabosham\LaravelComment\Contracts\Commentable;
use Aabosham\LaravelComment\HasComments;

class Product extends Model implements Commentable
{
    use HasComments;

    // ...
}
```

If you want to have your own Comment Model create a new one and extend my Comment model.

```
use Aabosham\LaravelComment\Models\Comment as LaravelComment;

class Comment extends LaravelComment
{
    // ...
}
```

and dont forget to update the model name in the `config/comment.php` file.

Comment package comes with several modes.

1- If you want to users can rate your commentable models;

```
class Product extends Model implements Commentable
{
    use HasComments;

    public function canBeRated(): bool
    {
        return true; // default false
    }

    //...
}
```

2- If you want to approve comments for your commentable models;

```
class Product extends Model implements Commentable
{
    use HasComments;

    public function mustBeApproved(): bool
    {
        return true; // default false
    }

    // ...
}
```

3- Sometimes you don't want to approve comments for all users;

```
class User extends Model
{
    use CanComment;

    protected $fillable = [
        'isAdmin',
        // ..
    ];

    public function canCommentWithoutApprove(): bool
    {
        return $this->isAdmin;
    }

    // ..
}
```

Usage
-----

[](#usage)

```
$user = App\User::first();
$product = App\Product::first();

// $user->comment(Commentable $model, $comment = '', $rate = 0);
$user->comment($product, 'Lorem ipsum ..', 3);

// approve it -- if the user model `canCommentWithoutApprove()` or you don't use `mustBeApproved()`, it is not necessary
$product->comments[0]->approve();

// get avg rating -- it calculates approved average rate.
$product->averageRate();

// get total comments count -- it calculates approved comments count.
$product->totalCommentsCount();
```

> Tip: You might want to look at the tests/CommentTest.php file to check all potential usages.

Change log
----------

[](#change-log)

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

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Mehmet Aydın Bahadır](https://github.com/aabosham)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Every ~428 days

Total

2

Last Release

1393d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/67c34ab5836206d1896bdac1432480b1e9ba7225e9e2adfb44b821b472c59e1c?d=identicon)[AAbosham](/maintainers/AAbosham)

---

Top Contributors

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

---

Tags

laravel-commentaabosham

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aabosham-laravel-comment/health.svg)

```
[![Health](https://phpackages.com/badges/aabosham-laravel-comment/health.svg)](https://phpackages.com/packages/aabosham-laravel-comment)
```

###  Alternatives

[kim/activity

Easily retrieve a list of users and guests that are online.

12730.4k](/packages/kim-activity)[naoray/eloquent-model-analyzer

Helpful methods to gain more information about eloquent model classes.

16429.8k1](/packages/naoray-eloquent-model-analyzer)[qlick/laravel-full-calendar

Laravel helper for FullCalendar.io. Fork of https://github.com/maddhatter/laravel-fullcalendar

1345.5k](/packages/qlick-laravel-full-calendar)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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