Search by

roundly-consulting / comments-for-laravel

mihaliak

Attach polymorphic comments to any Laravel model

Package info

github.com/roundly-consulting/comments-for-laravel

pkg:composer/roundly-consulting/comments-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 18:39 UTC

This package is auto-updated.

Last update: 2026-10-03 18:53:49 UTC


README

Comments for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Comments for Laravel

Polymorphic comments for any Laravel model: any model can write them and any model can receive them. Threaded replies, moderation, likes, reports, media attachments, @mentions and thread locking come built in.

Installation

Requires PHP 8.4 and Laravel 12 or 13.

composer require roundly-consulting/comments-for-laravel
php artisan vendor:publish --tag="comments-migrations"
php artisan vendor:publish --tag="likes-migrations" --tag="reports-migrations" --tag="approvals-migrations" --tag="media-migrations"
php artisan migrate

The second publish adds the tables of the likes, reports, approvals and media-library packages comments builds on. If your models have UUID/ULID keys, set COMMENTS_KEY_TYPE before migrating.

Usage

Give comments with one trait, receive them with another:

use Illuminate\Database\Eloquent\Model;
use RoundlyConsulting\Comments\Traits\GivesComments;
use RoundlyConsulting\Comments\Traits\HasComments;

class Post extends Model
{
    use HasComments;
}

class User extends Model
{
    use GivesComments;
}

Then write, reply, read and moderate through the facade:

use RoundlyConsulting\Comments\Facades\Comments;

$comment = Comments::on($post)->as($user)->body('Nice write-up!')->post();

Comments::on($post)->as($author)->reply($comment)->body('Thanks!')->post();  // a threaded reply

$post->threadedComments()->get();               // the public thread: approved comments + replies
Comments::for($post)->pending()->approveAll();  // moderate everything held for review
Comments::lock($post);                          // no new comments on this post

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/comments-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

The MIT License (MIT). Please see License File for more information.