PHPackages                             rizwan3d/comment-system - 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. rizwan3d/comment-system

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

rizwan3d/comment-system
=======================

A robust and flexible comment system for Laravel applications.

v1.0.0(1y ago)08MITPHPPHP ^7.4

Since May 20Pushed 1y ago1 watchersCompare

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

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

**Rizwan3d/CommentSystem**

This Laravel package provides a robust and flexible comment system for your applications. It enables you to seamlessly integrate commenting functionality into your models, allowing users to engage in discussions and leave feedback.

**Installation**

1. **Add the package to your project's `composer.json` file:**

    ```
    "require": {
        "rizwan3d/comment-system": "^1.0"
    }
    ```
2. **Run Composer to install the package:**

    ```
    composer update
    ```
3. **Register the service provider:**

    Open your `config/app.php` file and add the following line to the `providers` array:

    ```
    Rizwan3d\CommentSystem\Providers\CommentSystemServiceProvider::class,
    ```

**Usage**

1. **Apply the `Commentable` trait to your models:**

    The `Commentable` trait provides methods for adding and retrieving comments associated with your models. Add the following line at the top of your model class:

    ```
    use Rizwan3d\CommentSystem\Traits\Commentable;
    ```
2. **Adding Comments:**

    Use the `addComment` method to add a new comment to your model instance:

    ```
    $model->addComment($content);
    ```

    - Replace `$content` with the actual comment text.
3. **Retrieving Comments:**

    The `comments` method returns a collection of comments associated with your model instance:

    ```
    $comments = $model->comments;
    ```

    This method automatically retrieves comments with nested replies using eager loading.
4. **Model Relationships (Optional):**

    The package supports defining relationships between comments. You can add the `parent_id` field to your `Comment` model migration and define the following relationships:

    - `parent`: This belongs-to relationship allows you to link comments to their parent comment.
    - `comments`: This has-many relationship retrieves child comments of a specific comment.

**Example Usage**

```
use App\Post; // Replace with your model class

$post = Post::find(1);

$comment = $post->addComment('This post is great!');

$childComment = $comment->addComment('I agree!');

$allComments = $post->comments; // Includes $comment and $childComment
```

**Features**

- Integrates seamlessly with your Laravel models.
- Allows users to add comments to any model.
- Supports nested replies (optional).
- Provides methods for adding, retrieving, and managing comments.

**View Example**

### comment.blade.php

[](#commentbladephp)

```

    @foreach ($comments as $comment)
    {{$comment->content}}
    @include('comment',['comments' => $comment->comments])
    @endforeach

```

**Contributing**

We welcome contributions to this package! Please refer to the contribution guidelines for more information.

**License**

This package is licensed under the MIT License. See the `LICENSE` file for details.

**Additional Notes**

- Consider adding comments and explanations within the code for better readability.
- Feel free to extend the functionality of this package based on your specific requirements.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

728d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d630ddea99c446cc703e55735235ef51c11b7424b30f758f316a548343ac714?d=identicon)[rizwan3d](/maintainers/rizwan3d)

---

Top Contributors

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

---

Tags

comment-plugincomment-systemcomments-widgetlaravel-packagephpphp-librarylaravelcommentsfeedbackdiscussion

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/rizwan3d-comment-system/health.svg)

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

###  Alternatives

[tizis/lara-comments

Comments system for your Laravel application. Features: can be used to comment on any model, HTML filter customization (HTMLPurifier), API, comment rating, replies, events, auth rules ...

1194.7k](/packages/tizis-lara-comments)[mydnic/laravel-subscribers

Easily Manage Internal Newsletter Subscribers in Laravel — with campaigns, mail sending, and tracking

264.8k](/packages/mydnic-laravel-subscribers)[fbf/laravel-comments

A Laravel 4 package for adding commenting to a website that has user accounts

204.6k](/packages/fbf-laravel-comments)

PHPackages © 2026

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