PHPackages                             mrfabulous/laravelista\_comments\_lavarel\_8 - 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. mrfabulous/laravelista\_comments\_lavarel\_8

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

mrfabulous/laravelista\_comments\_lavarel\_8
============================================

Comments for Laravel.

3.6.1(5y ago)08MITPHPPHP ^7.2.5

Since Sep 29Pushed 5y agoCompare

[ Source](https://github.com/jschlies/comments)[ Packagist](https://packagist.org/packages/mrfabulous/laravelista_comments_lavarel_8)[ Patreon](https://www.patreon.com/laravelista)[ RSS](/packages/mrfabulous-laravelista-comments-lavarel-8/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (8)Versions (26)Used By (0)

Comments
========

[](#comments)

Comments is a Laravel package. With it you can easily implement native comments for your application.

[![Become a Patron](https://camo.githubusercontent.com/16fde1abb7601eba23de38f592bc54e3a7d10da24ac58db594d7fab32d449d46/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4265636f6d65253230612d506174726f6e2d6639363835342e7376673f7374796c653d666f722d7468652d6261646765)](https://www.patreon.com/laravelista)

Overview
--------

[](#overview)

This package can be used to comment on any model you have in your application.

All comments are stored in a single table with a polymorphic relation for content and a polymorphic relation for the user who posted the comment.

### Features

[](#features)

- View comments
- Create comments
- Delete comments
- Edit comments
- **Reply to comments**
- **Authorization rules**
- **Support localization**
- **Dispatch events**
- **Route, Controller, Comment, Migration &amp; View customizations**
- **Support for non-integer IDs**
- **Support for multiple User models**
- **Solved N+1 query problem**
- **Comment approval (opt-in)**
- **Guest commenting (opt-in)**
- **Pagination (opt-in)**
- **Soft deletes (opt-in)**
- **Works with custom ID columns** \[New\]

### Screenshots

[](#screenshots)

Here are a few screenshots.

No comments &amp; guest:

[![](https://camo.githubusercontent.com/264e6915c0bb966e251c87be7fa5f4ad3247db56ea910c4e3f2ec2df13411018/68747470733a2f2f692e696d6775722e636f6d2f3964663458756e2e706e67)](https://camo.githubusercontent.com/264e6915c0bb966e251c87be7fa5f4ad3247db56ea910c4e3f2ec2df13411018/68747470733a2f2f692e696d6775722e636f6d2f3964663458756e2e706e67)

No comments &amp; logged in:

[![](https://camo.githubusercontent.com/0784c78a8430f2b6da145921197ed49726e7141244e42e57a0d4bd2e9202e55d/68747470733a2f2f692e696d6775722e636f6d2f414c49364762522e706e67)](https://camo.githubusercontent.com/0784c78a8430f2b6da145921197ed49726e7141244e42e57a0d4bd2e9202e55d/68747470733a2f2f692e696d6775722e636f6d2f414c49364762522e706e67)

One comment:

[![](https://camo.githubusercontent.com/925fcf402a670fc73a8bdcb6be8ab05ba8270afa272acbacb03b533e5c04d748/68747470733a2f2f692e696d6775722e636f6d2f3977424e6979322e706e67)](https://camo.githubusercontent.com/925fcf402a670fc73a8bdcb6be8ab05ba8270afa272acbacb03b533e5c04d748/68747470733a2f2f692e696d6775722e636f6d2f3977424e6979322e706e67)

One comment edit form:

[![](https://camo.githubusercontent.com/ec9aafbae41358688d2fdecc5b12f4a42c1e900f0384c4aa52e1fd8a396e0128/68747470733a2f2f692e696d6775722e636f6d2f6378446833344f2e706e67)](https://camo.githubusercontent.com/ec9aafbae41358688d2fdecc5b12f4a42c1e900f0384c4aa52e1fd8a396e0128/68747470733a2f2f692e696d6775722e636f6d2f6378446833344f2e706e67)

Two comments from different users:

[![](https://camo.githubusercontent.com/4d4650eb726f4c0571931e080798c6112b956944fc97184610dadaa8072d5fa0/68747470733a2f2f692e696d6775722e636f6d2f325035753235782e706e67)](https://camo.githubusercontent.com/4d4650eb726f4c0571931e080798c6112b956944fc97184610dadaa8072d5fa0/68747470733a2f2f692e696d6775722e636f6d2f325035753235782e706e67)

### Tutorials &amp; articles

[](#tutorials--articles)

I plan to expand this chapter with more tutorials and articles. If you write something about this package let me know, so that I can update this chapter.

**Screencasts:**

- [Adding comments to your Laravel application](https://www.youtube.com/watch?v=YhA0CSX1HIg) by Andre Madarang.

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

[](#installation)

From the command line:

```
composer require laravelista/comments
```

### Run migrations

[](#run-migrations)

We need to create the table for comments.

```
php artisan migrate
```

### Add Commenter trait to your User model

[](#add-commenter-trait-to-your-user-model)

Add the `Commenter` trait to your User model so that you can retrieve the comments for a user:

```
use Laravelista\Comments\Commenter;

class User extends Authenticatable
{
    use Notifiable, Commenter;
}
```

### Add Commentable trait to models

[](#add-commentable-trait-to-models)

Add the `Commentable` trait to the model for which you want to enable comments for:

```
use Laravelista\Comments\Commentable;

class Product extends Model
{
    use Commentable;
}
```

### Publish Config &amp; configure (optional)

[](#publish-config--configure-optional)

Publish the config file (optional):

```
php artisan vendor:publish --provider="Laravelista\Comments\ServiceProvider" --tag=config
```

### Publish views (customization)

[](#publish-views-customization)

The default UI is made for Bootstrap 4, but you can change it however you want.

```
php artisan vendor:publish --provider="Laravelista\Comments\ServiceProvider" --tag=views
```

### Publish Migrations (customization)

[](#publish-migrations-customization)

You can publish migration to allow you to have more control over your table

```
php artisan vendor:publish --provider="Laravelista\Comments\ServiceProvider" --tag=migrations
```

Usage
-----

[](#usage)

In the view where you want to display comments, place this code and modify it:

```
@comments(['model' => $book])

```

In the example above we are setting the `commentable_type` to the class of the book. We are also passing the `commentable_id` the `id` of the book so that we know to which book the comments relate to. Behind the scenes, the package detects the currently logged in user if any.

If you open the page containing the view where you have placed the above code, you should see a working comments form.

### View only approved comments

[](#view-only-approved-comments)

To view only approved comments, use this code:

```
@comments([
    'model' => $book,
    'approved' => true
])

```

### Paginate comments

[](#paginate-comments)

Pagination paginates by top level comments only, meaning that if you specify the number of comments per page to be 1, and that one comment has 100 replies, it will display that one comment and all of its replies.

It was not possible to do it any other way, because if I paginate by all comments (parent and child) you will end up with blank pages since the comments components loops parent comments first and then uses recursion for replies.

To use pagination, use this code:

```
@comments([
    'model' => $user,
    'perPage' => 2
])

```

Replace `2` with any number you want.

Events
------

[](#events)

This package fires events to let you know when things happen.

- `Laravelista\Comments\Events\CommentCreated`
- `Laravelista\Comments\Events\CommentUpdated`
- `Laravelista\Comments\Events\CommentDeleted`

REST API
--------

[](#rest-api)

To change the controller or the routes, see the config.

```
Route::post('comments', '\Laravelista\Comments\CommentController@store');
Route::delete('comments/{comment}', '\Laravelista\Comments\CommentController@destroy');
Route::put('comments/{comment}', '\Laravelista\Comments\CommentController@update');
Route::post('comments/{comment}', '\Laravelista\Comments\CommentController@reply');

```

### POST `/comments`

[](#post-comments)

Request data:

```
'commentable_type' => 'required|string',
'commentable_id' => 'required|string|min:1',
'message' => 'required|string'

```

### PUT `/comments/{comment}`

[](#put-commentscomment)

- {comment} - Comment ID.

Request data:

```
'message' => 'required|string'

```

### POST `/comments/{comment}`

[](#post-commentscomment)

- {comment} - Comment ID.

Request data:

```
'message' => 'required|string'

```

Upgrading from older versions (troubleshoot)
--------------------------------------------

[](#upgrading-from-older-versions-troubleshoot)

Before creating an issue, read [this](./UPGRADE.md).

Sponsors &amp; Backers
----------------------

[](#sponsors--backers)

I would like to extend my thanks to the following sponsors &amp; backers for funding my open-source journey. If you are interested in becoming a sponsor or backer, please visit the [Backers page](https://mariobasic.com/backers).

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

[](#contributing)

Thank you for considering contributing to Comments! The contribution guide can be found [Here](https://mariobasic.com/contributing).

Code of Conduct
---------------

[](#code-of-conduct)

In order to ensure that the open-source community is welcoming to all, please review and abide by the [Code of Conduct](https://mariobasic.com/code-of-conduct).

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 87.8% 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 ~60 days

Recently: every ~7 days

Total

23

Last Release

2185d ago

Major Versions

1.1.2 → 2.0.02018-07-01

2.1.0 → 3.0.02019-07-01

PHP version history (4 changes)1.1.0PHP &gt;=5.6.4

2.0.0PHP 7.2.\*

2.0.2PHP ^7.1.3

3.5.0PHP ^7.2.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/05aed758d1ffdc009915c07853ef71249720438980fa0ba0ee91107eebed252a?d=identicon)[jschlies](/maintainers/jschlies)

---

Top Contributors

[![mabasic](https://avatars.githubusercontent.com/u/1839930?v=4)](https://github.com/mabasic "mabasic (108 commits)")[![rocramer](https://avatars.githubusercontent.com/u/4487988?v=4)](https://github.com/rocramer "rocramer (6 commits)")[![bosunski](https://avatars.githubusercontent.com/u/15146515?v=4)](https://github.com/bosunski "bosunski (2 commits)")[![imnotjames](https://avatars.githubusercontent.com/u/1551593?v=4)](https://github.com/imnotjames "imnotjames (2 commits)")[![joelwmale](https://avatars.githubusercontent.com/u/3906839?v=4)](https://github.com/joelwmale "joelwmale (1 commits)")[![mattrabe](https://avatars.githubusercontent.com/u/1786783?v=4)](https://github.com/mattrabe "mattrabe (1 commits)")[![Riaan-ZA](https://avatars.githubusercontent.com/u/1535640?v=4)](https://github.com/Riaan-ZA "Riaan-ZA (1 commits)")[![fey](https://avatars.githubusercontent.com/u/697178?v=4)](https://github.com/fey "fey (1 commits)")[![thewebartisan7](https://avatars.githubusercontent.com/u/57477934?v=4)](https://github.com/thewebartisan7 "thewebartisan7 (1 commits)")

---

Tags

laravelcomments

### Embed Badge

![Health badge](/badges/mrfabulous-laravelista-comments-lavarel-8/health.svg)

```
[![Health](https://phpackages.com/badges/mrfabulous-laravelista-comments-lavarel-8/health.svg)](https://phpackages.com/packages/mrfabulous-laravelista-comments-lavarel-8)
```

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k49.4M479](/packages/laravel-scout)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[laravelista/comments

Comments for Laravel.

744192.4k1](/packages/laravelista-comments)

PHPackages © 2026

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