---
title: "Comments for Laravel — docs | Roundly"
description: "Developer docs for Comments for Laravel: threaded replies, moderation, blocklist, mentions, locks, likes, reports, attachments and API resources."
url: https://roundly-consulting.com/open-source/docs/comments-for-laravel
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

Open source

# Comments for Laravel

Install

`composer require roundly-consulting/comments-for-laravel`

Requires: PHP ^8.4 · Laravel ^12.0|^13.0

[GitHub](https://github.com/roundly-consulting/comments-for-laravel) [Packagist](https://packagist.org/packages/roundly-consulting/comments-for-laravel) [Donate (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Patreon](https://www.patreon.com/cw/roundly)

## Overview

Polymorphic comments for Laravel. Any Eloquent model can receive comments and any model can write them — with threaded replies, a pending/approved/hidden moderation workflow, a blocklist filter, @mentions, thread locks, per-comment metadata and a discoverable Comments facade. Likes, report-a-comment moderation and media attachments come built in through sibling Roundly packages. MIT-licensed, with no third-party runtime dependencies beyond Laravel and those packages.

### What you get

#### Comment on anything

Any model receives comments and any model writes them — plus anonymous guest comments, all in one polymorphic table.

#### Threaded replies

Replies link to their parent and stay on the root subject, with a depth limit that also bounds eager-loading.

#### Moderation built in

Pending, approved and hidden states, an approval queue, bulk moderation and a word or regex blocklist.

#### Likes & reports

Rank threads by most-liked or trending, and auto-hide comments once a report is upheld or a threshold is crossed.

#### Attachments & inline media

A private attachments bucket per comment, with \[media:UUID\] tokens rendered as responsive images or links.

#### Mentions & locks

@handles parsed and resolved to your models, plus locks for a whole subject or the thread under one comment.

#### Metadata & merges

Tag each comment with your own namespaced metadata and filter by it, and move a whole discussion in one call when two records merge.

#### Facade, DI or actions

One Comments facade, the injectable CommentsManager or single actions — and a recording Comments::fake() plus a drop-in JSON resource.

### Documentation

#### [Installation](https://roundly-consulting.com/open-source/docs/comments-for-laravel/installation.md)

Install via Composer, publish and run the migrations — the sibling packages’ too — upgrade from 1.0, and optionally publish config and translations.

#### [Configuration](https://roundly-consulting.com/open-source/docs/comments-for-laravel/configuration.md)

Every config key and its default — model, key type, approval, limits, blocklist, mentions, authorization, author resource, auto-moderation and media.

#### [Preparing your models](https://roundly-consulting.com/open-source/docs/comments-for-laravel/preparing-models.md)

Add HasComments to models that receive comments and GivesComments to authors — or swap in your own Comment model.

#### [The Comments facade](https://roundly-consulting.com/open-source/docs/comments-for-laravel/facade.md)

The whole API in one place — a fluent write builder, edits, moderation, site-wide and scoped queries, locks, transfers, a blocklist check and fake().

#### [DI and actions](https://roundly-consulting.com/open-source/docs/comments-for-laravel/without-facade.md)

Inject CommentsManager for the same API without static calls, or run one of eleven action classes directly from a job or your own action.

#### [Writing comments](https://roundly-consulting.com/open-source/docs/comments-for-laravel/writing-comments.md)

Write comments through the fluent Comments facade, a typed DTO or the author trait — with body, lock and blocklist checks on every write.

#### [Editing, deleting & restoring](https://roundly-consulting.com/open-source/docs/comments-for-laravel/editing-deleting.md)

Edit a comment’s body, soft-delete and restore it — edits are re-validated, lock-checked and re-scanned for mentions.

#### [Threaded replies](https://roundly-consulting.com/open-source/docs/comments-for-laravel/threaded-replies.md)

Replies link to their parent and stay on the root subject; depth is capped by max\_depth, which also bounds eager-loading.

#### [Reading & counting comments](https://roundly-consulting.com/open-source/docs/comments-for-laravel/reading-comments.md)

Read comments through model relations or the fluent CommentQuery — filters, ordering, pagination, escape hatches and N+1-free counts.

#### [Comment metadata](https://roundly-consulting.com/open-source/docs/comments-for-laravel/metadata.md)

Attach your own namespaced metadata to each comment, read it back by dot path and filter comments by it — the same on SQLite, PostgreSQL and MySQL.

#### [Moderation](https://roundly-consulting.com/open-source/docs/comments-for-laravel/moderation.md)

Pending, approved and hidden states, an optional approval queue, moderation scopes and bulk approve, hide or delete.

#### [Spam & blocklist filter](https://roundly-consulting.com/open-source/docs/comments-for-laravel/blocklist.md)

Reject, hold or hide comments that match banned words or regular expressions, or check a body yourself — no external service needed.

#### [@mentions](https://roundly-consulting.com/open-source/docs/comments-for-laravel/mentions.md)

Parse @handles on every write and edit, store them, and resolve them to your models — CommentMentioned fires once per person, after approval.

#### [Locking threads](https://roundly-consulting.com/open-source/docs/comments-for-laravel/locking.md)

Lock a subject’s whole comment section, or the whole thread under one comment, to stop new and edited comments.

#### [Transferring comments](https://roundly-consulting.com/open-source/docs/comments-for-laravel/transferring-comments.md)

Move a whole discussion from one record to another when duplicates merge — replies, held and deleted comments included, with likes and attachments.

#### [Likes & ranking](https://roundly-consulting.com/open-source/docs/comments-for-laravel/likes.md)

Like, upvote and react to comments via Likes for Laravel, then rank threads by most-liked or trending with per-viewer state in one query.

#### [Reporting & auto-moderation](https://roundly-consulting.com/open-source/docs/comments-for-laravel/reports.md)

Let users and guests report comments via Reports for Laravel, build moderation queues, and auto-hide comments on upheld reports.

#### [Attachments & inline media](https://roundly-consulting.com/open-source/docs/comments-for-laravel/media.md)

Attach files to a comment’s own bucket via Media Library for Laravel, and embed them in the body with \[media:UUID\] tokens.

#### [Authorization](https://roundly-consulting.com/open-source/docs/comments-for-laravel/authorization.md)

Opt in to gate every mutation — writes, edits, deletes, restores, moderation, locks and transfers — through a Comment policy built on the bundled one.

#### [API resources](https://roundly-consulting.com/open-source/docs/comments-for-laravel/api-resources.md)

Return comments as JSON with CommentResource — nested replies, author and status, plus likes and attachments when loaded.

#### [Events](https://roundly-consulting.com/open-source/docs/comments-for-laravel/events.md)

Nine events — created, updated, deleted, approved, hidden, thread locked and unlocked, mentioned and transferred — for notifications and audits.

#### [Exceptions & messages](https://roundly-consulting.com/open-source/docs/comments-for-laravel/exceptions.md)

Every failure is a typed CommentsException with a translatable message — catch the base class, or handle each case.

#### [Testing](https://roundly-consulting.com/open-source/docs/comments-for-laravel/testing.md)

Comments::fake() records every mutation while still running it, with an assert per verb — plus factories that need no setup and AssertsComments.

#### [Requirements](https://roundly-consulting.com/open-source/docs/comments-for-laravel/requirements.md)

PHP 8.4+, Laravel 12 or 13, and the sibling Roundly packages Composer installs for you.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source.md)
