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

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

devianl2/laravel-comment
========================

Laravel comment and rateable package

1.0.6(3y ago)012MITPHPPHP ^7.4 || ^8.0

Since May 13Pushed 3y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (6)Versions (8)Used By (0)

Laravel Comment and Rating Package
==================================

[](#laravel-comment-and-rating-package)

This Laravel package provides a robust solution for managing comments and ratings in your Laravel application. It allows you to easily perform the following actions:

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

[](#installation)

You can install the package via Composer by running the following command:

```
composer require devianl2/laravel-comment
```

Usage
-----

[](#usage)

To use this package, you need to follow these steps:

1. **Set up the package** : After installation, make sure to publish the package configuration and migrations.

```
php artisan vendor:publish --provider="Devianl2\CommentRateable\CommentRateableServiceProvider" --tag="migrations"
php artisan migrate
```

2. **Add the trait to your Post model** : In order to enable comment and rating functionality, add the `CommentRateable` trait to your Post model.

```
use Devianl2\CommentRateable\Traits\CommentRateable;

class Post extends Model
{
    use CommentRateable;
}
```

3. **Perform actions** : You can now use the available methods on your Post model to perform actions, such as retrieving comments, getting average ratings, or deleting comments.

Use Case
--------

[](#use-case)

### Save Comment

[](#save-comment)

```
$post = Post::first();
$comment = $post->comment([
    'title' => 'This is a test title',
    'body' => 'And we will add some shit here',
    'rating' => 5,
    'is_approved' => true, // This is optional and defaults to false
], $user);
```

### Update Comment

[](#update-comment)

```
$post = Post::first();
$comment = $post->updateComment(
    $commentId,
    [
        'title' => 'This is a test title',
        'body' => 'And we will add some shit here',
        'rating' => 5,
        'is_approved' => true, // This is optional and defaults to false
    ], $user);
```

### Other Methods

[](#other-methods)

1. Get average rating: Retrieve the average rating for a post.

```
$post = Post::first();
$post->averageRating();
```

2. Get comments: Retrieve all comments for a post.

```
$post->getComments();
```

3. Get approved comments: Retrieve only approved comments for a post.

```
$post->getComments(true);
```

4. Get paginated approved comments: Retrieve approved comments for a post with pagination.

```
$post->getComments(true, true);
```

5. Get all comments without pagination: Retrieve all comments for a post without pagination and limits. (Set the limit to 0 for unlimited comments)

```
$post->getComments(true, false, 0);
```

6. Delete comment: Delete a comment.

```
$comment->delete();
```

Contribution
------------

[](#contribution)

Contributions to this package are always welcome. If you find any issues or want to add new features, please create an issue or submit a pull request on the GitHub repository of this package.

License
-------

[](#license)

This package is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT) .

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Total

7

Last Release

1100d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/258988219cf511bbd9c2809a6ba1653006dee578e2db26cb813aa99f6a24a319?d=identicon)[devianl2](/maintainers/devianl2)

---

Top Contributors

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

---

Tags

laravelcommentRatingrateablecommentablereview-rating

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  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)[willvincent/laravel-rateable

Allows multiple models to be rated with a fivestar like system.

416452.0k3](/packages/willvincent-laravel-rateable)[codebyray/laravel-review-rateable

Review &amp; Rating system for Laravel 10, 11 &amp; 12

310351.9k](/packages/codebyray-laravel-review-rateable)[ghanem/rating

Rating system for Laravel

8615.5k](/packages/ghanem-rating)[glhd/special

1929.4k](/packages/glhd-special)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

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