ruvelo / laravel-comments
Free, polished comments for any Eloquent model: threads, Markdown, reactions, @mentions that notify, spam protection and moderation. Blade or JSON, no Livewire required.
Requires
- php: ^8.3
- laravel/framework: ^12.4.1|^13.0
- league/commonmark: ^2.6
Requires (Dev)
- larastan/larastan: ^3.13
- laravel/pint: ^1.32
- orchestra/testbench: ^10.0|^11.0
- phpunit/phpunit: ^11.5|^12.0
- ruvelo/laravel-inbox: ^1.1
Suggests
- filament/filament: Moderate comments from a Filament panel with CommentsPlugin (^4.0|^5.0)
- ruvelo/laravel-inbox: Show comment, reply and mention notifications in an in-app inbox and bell, with per-type preferences (^1.1)
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-05 10:17:05 UTC
README
Live demo Configuration Integrations Developer guide Changelog
Laravel Comments
Comments for any Eloquent model: threaded replies, Markdown and reactions, in one Blade component.
Quick start
composer require ruvelo/laravel-comments
php artisan migrate
Add the trait to the model people comment on:
use Ruvelo\Comments\Concerns\HasComments; class Post extends Model { use HasComments; }
List it under a short name (the name URLs use), in config/comments.php (php artisan vendor:publish --tag=comments-config):
'commentables' => [ 'post' => App\Models\Post::class, ],
And show the thread on its page:
<x-comments::thread :for="$post" />
That's it. Signed-in users can comment, reply and react; guests can read. No Livewire, no frontend build step. Want a look first? Click around the live demo.
What you get
- Comments on any model, by any author model (your
User, aCustomer, aTeam). - Threaded replies, two levels deep by default.
- Safe Markdown, with code blocks and tables.
- Emoji reactions, one click to add or remove.
- Edit and delete; a deleted comment with replies leaves a placeholder.
- Spam protection that needs no setup: a honeypot, a minimum time to submit, and rate limits.
- Works without JavaScript, and answers JSON on the same routes for Inertia, React and Vue.
- Light and dark, accessible, and styles that never leak into your page.
Optional features
All of these are off by default.
Mentions and autocomplete
@maya links to a person and notifies them, and the form suggests people as you type @. Off by default: set mentions.resolver (for example to the bundled ColumnResolver). Details.
Email and in-app notifications
Tells authors about replies, and the model's owner about new comments (through the commentNotifiables() hook), by database or mail. They show up in ruvelo/laravel-inbox with no extra code. Off by default: set COMMENTS_NOTIFICATIONS=true. Details.
Approval queue
Hold new comments until a moderator approves them, on a moderation page or from the terminal. Off by default: set require_approval to true and define the comments-moderate gate. Details.
Akismet spam checks
Checks each comment with Akismet and holds what it flags for a moderator. Off by default: set COMMENTS_AKISMET=true and AKISMET_KEY. Details.
Filament moderation page
The moderation queue as a Filament panel page. Off by default: register CommentsPlugin in your panel. Details.
A quick tour
Comments where your content is. A thread under a post, an invoice, a ticket or anything else with an Eloquent model. Replies nest to the depth you choose, code blocks and @mentions render properly, and people react with one click.
Write, preview, post. The compose box has a Write/Preview toggle and a Markdown hint. Replies and edits open in place and post without a reload. With JavaScript off, every button is still a plain HTML form that works.
Moderate when you need to. Turn on require_approval and new comments wait in a queue until a moderator approves them; comments the spam checks flag wait there too, under Spam. Each item links to where it lives. Work the same queue from the terminal (php artisan comments:moderate) or a Filament panel.
![]() |
![]() |
| Light and dark, following each reader's system setting. | Mobile first, readable and usable at phone width. |
Full feature list
- Any model, any author: a
HasCommentstrait for what's commented on, and any model as the author (yourUser, aCustomer, aTeam). Both are polymorphic. - Threads: replies nest up to
max_depth(2 by default: comments and replies). A reply to the deepest level joins that level instead of nesting further. - Safe Markdown: GitHub-style, with code blocks, tables and task lists. Raw HTML is escaped,
javascript:links are dropped, outside links getrel="nofollow", and images become links so readers never load a stranger's URL. - Mentions that notify (opt-in):
@mayalinks to a person, is stored with the comment, and sends them a notification (database and/or mail). Use the bundled resolver on any column of your user model, your own class, or a couple of closures. The comment form suggests people as you type@. - Reactions: a fixed set of emoji (👍 ❤️ 🎉 😄 😮 😢 by default), one of each per person, toggled with a click. Hover a reaction to see who gave it.
- Edits and deletes: edited comments say so. A deleted comment with replies stays as "This comment was deleted", so the conversation still makes sense.
- Moderation: an optional approval queue and a moderation page with waiting, spam, approved and deleted tabs; approve, mark as spam or reject. Also as an artisan command and an optional Filament resource.
- Permissions as gates: sensible defaults, each overridable with one
Gate::define. - Spam protection: a honeypot field, a minimum time-to-submit, per-author and per-IP rate limits, a link limit, and pluggable spam checkers, including a bundled Akismet checker (off until you add a key). Flagged comments are held for a moderator instead of published; blatant spam is dropped.
- Notifications, off by default: the model's owner hears about new comments, authors hear about replies, mentioned people hear they were mentioned. Never about your own comment, never twice, and people can opt out. Standard Laravel notifications whose database payload has
title,body,url,iconandactor, so they show up in ruvelo/laravel-inbox with no setup. - Works without JavaScript, and gets better with it: posting, editing, deleting, reactions and previews happen in place.
- JSON API on the same routes for SPAs, Inertia, Livewire or mobile apps: paginated threads with nested replies, create, update, delete, react and preview.
- Fast: a thread page takes the same handful of queries whether it has 2 comments or 200 (there's a test for that).
- Light and dark, self-contained styles that never leak into your page, and accessible markup: labels, roles,
aria-pressedreactions, keyboard-operable everything.
Commentable models and authors
1. Make a model commentable and list it under a short name. The name is what URLs and the JSON API use; class names sent by a browser are never trusted.
use Ruvelo\Comments\Concerns\HasComments; class Post extends Model { use HasComments; // Optional: where the post lives, for permalinks, notifications and moderation. public function commentUrl(): ?string { return route('posts.show', $this); } }
// config/comments.php (php artisan vendor:publish --tag=comments-config) 'commentables' => [ 'post' => App\Models\Post::class, ],
Aliases from your Relation::morphMap() work too.
2. Show the thread on the post's page:
<x-comments::thread :for="$post" />
It brings its own styles and script, included once per page. Signed-in users can comment; guests see the thread and a "Sign in to comment" link to your login route (or plain text if you don't have one).
3. Optionally, tell it about your users. Without anything, authors show their name and initials. Implement CommentAuthor to choose a name or add real avatars:
use Ruvelo\Comments\Concerns\IsCommentAuthor; use Ruvelo\Comments\Contracts\CommentAuthor; class User extends Authenticatable implements CommentAuthor { use IsCommentAuthor; public function commentAuthorAvatarUrl(): ?string { return $this->profile_photo_url; } }
Hooks on the commentable
All optional; HasComments provides defaults.
| Method | Default | |
|---|---|---|
commentsAreOpen(): bool |
true |
Return false to close the thread. Existing comments stay visible |
commentUrl(): ?string |
null |
Where the model lives. Used by permalinks, notifications and the moderation page |
commentTitle(): string |
its title, name or "Post #12" |
How the model is named in notifications and moderation |
commentNotifiables(): iterable |
[] |
Who hears about new comments when notifications are on, usually the owner |
Who can do what
Every write goes through a gate. Define a gate with the same name to decide yourself, for example in your AppServiceProvider:
| Gate | Arguments | Default |
|---|---|---|
comments-create |
$user, $commentable |
Any signed-in user |
comments-update |
$user, $comment |
The author, within edit_window |
comments-delete |
$user, $comment |
The author, or a moderator |
comments-react |
$user, $comment |
Any signed-in user, on published comments |
comments-moderate |
$user |
Nobody, until you define it |
use Illuminate\Support\Facades\Gate; Gate::define('comments-moderate', fn ($user) => $user->is_admin); Gate::define('comments-create', fn ($user, $post) => $user->hasVerifiedEmail());
Moderation
Set require_approval to true and new comments wait until someone who passes comments-moderate approves them. Their author still sees them, marked "Waiting for approval"; moderators' own comments are approved straight away.
Whatever require_approval says, comments the spam checks flag are held too, with their reason ("Akismet", "Too many links"). Their author sees them waiting like any held comment, so spammers learn nothing; nobody else sees them, and nobody is notified until a moderator approves one.
Moderators review the queue at /comments/moderation: Waiting, Spam, Approved and Deleted tabs, and on each comment Approve ("Not spam: approve" for spam), Spam (takes a published comment down and holds it) and Reject (deletes it, replies stay). Each links to where the comment lives.
From the terminal:
php artisan comments:moderate # what's waiting (--limit=20)
php artisan comments:moderate --status=spam # held spam, with the reason
php artisan comments:moderate --approve=12 --approve=14
php artisan comments:moderate --spam=15 --reject=16,17
And from PHP: Comments::approve($comment), Comments::markAsSpam($comment, by: $moderator), Comments::reject($comment, by: $moderator). With Filament, the same queue is a panel resource.
Spam protection
Everything here guards the routes, and moderators skip all of it. The PHP API runs the content checks (links and spam checkers) only when you pass it the request: Comments::post($post, $user, $text, request: $request).
| Check | Default | What happens |
|---|---|---|
| Honeypot | field website |
A hidden field people never fill in. Posts that fill it are dropped, with a friendly "Thanks." |
| Time to submit | 3 seconds | The form carries an encrypted timestamp; a post sent sooner is refused with "Give it a moment, then post again." Clients that don't send the field (the JSON API, SPAs) skip it |
| Rate limits | 5 per author, 20 per IP, per minute | 429 with how long to wait, through Laravel's RateLimiter |
| Link limit | off | More links than max_links (mentions don't count): hold the comment for a moderator, or reject it with a message |
| Spam checkers | none, Akismet off | Each class in spam.checkers, then Akismet when it's on. Spam is held; certain spam is dropped |
A spam checker is one method. The comment isn't saved yet; it has its body, rendered HTML, author, commentable and parent:
use Illuminate\Http\Request; use Ruvelo\Comments\Contracts\SpamChecker; use Ruvelo\Comments\Models\Comment; use Ruvelo\Comments\Spam\Verdict; class BlockedWords implements SpamChecker { public function check(Comment $comment, Request $request): Verdict { return str_contains(strtolower($comment->body), 'casino') ? Verdict::Spam : Verdict::Ham; } } // config/comments.php 'spam' => ['checkers' => [App\Spam\BlockedWords::class], /* akismet... */],
Verdict::Ham lets it through, Verdict::Spam holds it under Spam, Verdict::Discard drops it without storing it (the poster still sees "Thanks."; Comments::post() throws SpamDetected). Checkers run in order and the first that isn't Ham decides. For Akismet, see Integrations.
Integrations
All optional, and none is a dependency: install what you use.
laravel-inbox
ruvelo/laravel-inbox shows Laravel's database notifications in a bell and an inbox page. Comment notifications store the fields it reads, so with both packages installed and notifications on, they appear with no presenter or other code:
composer require ruvelo/laravel-inbox
COMMENTS_NOTIFICATIONS=true
| Kind | Title | Icon |
|---|---|---|
| Comment on your model | Ada Lovelace commented on “Release notes” | 💬 |
| Reply to your comment | Ada Lovelace replied to your comment | ↩️ |
| Mention | Ada Lovelace mentioned you on “Release notes” | @ |
Each shows the comment as plain text (shortened to fit) under its title, and clicking it opens the comment's permalink, which lands on the comment on its page. actor is the author's name, and the inbox labels the types "Comment posted" and "Mentioned in comment". Set an icon to null in notifications.icons to show the author's initials instead. The payload also has kind (comment, reply or mention), comment_id, commentable_type and commentable_id for your own use.
The notifications respect laravel-inbox's preferences: register their types and people can switch each channel on its preferences page.
// config/inbox.php 'preferences' => [ Ruvelo\Comments\Notifications\MentionedInComment::class => [ 'label' => 'Mentions', 'group' => 'Comments', 'channels' => ['mail', 'database'], ], Ruvelo\Comments\Notifications\CommentPosted::class => [ 'label' => 'Comments and replies', 'group' => 'Comments', 'channels' => ['mail', 'database'], ], ],
Akismet
The bundled checker calls Akismet's comment-check API with the comment, its author's name and email, the poster's IP address, user agent and referrer, and the page's permalink. It's off until you turn it on with a key from akismet.com:
COMMENTS_AKISMET=true
AKISMET_KEY=your-key
# AKISMET_SITE=https://example.com (defaults to APP_URL)
# AKISMET_TEST=true (while trying it out)
Akismet's spam is held under Spam with the reason "Akismet"; what it marks as blatant (X-akismet-pro-tip: discard) is dropped. If Akismet is down, slow or rejects the key, comments go through as usual and a warning is logged: an outage never stops people commenting. Akismet runs after your own spam.checkers, and only when none of them has decided.
Filament
With Filament 4 or 5 installed, add the moderation queue to a panel:
use Ruvelo\Comments\Filament\CommentsPlugin; public function panel(Panel $panel): Panel { return $panel // ... ->plugin(CommentsPlugin::make()->navigationGroup('Community')); }
You get a "Comments" page with Waiting, Spam, Approved and Deleted tabs (with counts), a badge in the navigation for what's waiting, search, Approve / Not spam, Spam and Reject on each comment, and the same three as bulk actions. Only people who pass comments-moderate see it. Nothing Filament-related loads unless you register the plugin.
Making it look like your app
The thread's styles are scoped to .comments and driven by CSS variables. Override any of them on .comments to re-theme:
.comments { --comments-accent: #0f766e; --comments-radius: 4px; --comments-sans: Inter, sans-serif; }
The thread follows the reader's light or dark setting. If your app is light-only, pin it: <x-comments::thread :for="$post" data-theme="light" /> (or dark).
For deeper changes, publish the views:
php artisan vendor:publish --tag=comments-views
They land in resources/views/vendor/comments: components/thread.blade.php, the partials/ it's built from (one comment, the form, reactions, styles and script), and moderation.blade.php. To put the moderation page inside your app's chrome, set layout to your layout view; the page fills the layout_section section.
For developers
PHP API
Ruvelo\Comments\Comments is the one write path: the routes use it too.
use Ruvelo\Comments\Comments; $comment = Comments::post($post, $user, 'Ship **it**'); // or a reply: Comments::post($post, $other, 'Thanks @maya', parent: $comment); Comments::update($comment, 'Ship **it** on Friday'); // marks it edited Comments::delete($comment, by: $user); // soft: replies stay Comments::react($comment, $user, '🎉'); // true when added, false when removed Comments::approve($comment); // publishes a waiting or spam comment Comments::markAsSpam($comment, by: $moderator); // takes it down, holds it under Spam Comments::reject($comment, by: $moderator); // deletes it (replies stay) Comments::post($post, $user, $text, request: $request); // also run the link limit and spam checkers Comments::for($post)->latest()->limit(5)->get(); // published comments, authors and reactions loaded Comments::thread($post, viewer: $user, sort: 'newest'); // a page as $user sees it, replies nested Comments::countFor($post); Post::withCommentsCount()->get(); // adds comments_count, no N+1 Comments::render('**Markdown**'); // the same safe HTML comments get Comments::allows('comments-update', $user, $comment); Comment::query()->mentioning($user)->get(); // comments that mention someone Comment::query()->pending()->get(); // also ->spam(), ->approved() $comment->mentions; // Mention models: ->mentioned is the person $comment->moderationStatus(); // pending, approved or spam
The PHP API doesn't check permissions or rate limits, so imports and seeders aren't slowed down. Call Comments::allows() (or authorize(), which throws NotAllowed) when acting for a user.
JSON API
Every route answers JSON when the request sends Accept: application/json, so the same endpoints serve the Blade component, Inertia pages and SPAs. They use the session (the web middleware) by default; set middleware to suit your app, e.g. ['web', 'auth:sanctum']. The {type} is the short name from commentables.
| Request | Does |
|---|---|
GET /comments/threads/{type}/{id}?sort=&page=&per_page= |
A page of top-level comments, each with nested replies. meta adds comments_count, can_comment, reactions and max_depth |
POST /comments/threads/{type}/{id} |
Create {body, parent_id?}. 201 with the comment, comments_count, message and a rendered html fragment |
PATCH /comments/{id} |
Update {body} |
DELETE /comments/{id} |
Delete. The comment comes back with deleted: true |
POST /comments/{id}/reactions |
Toggle {emoji}. Returns added and the new reactions |
POST /comments/preview |
{body} in, {html} out |
GET /comments/mentions?q=ma |
Up to 8 people whose handle starts with ma: {data: [{handle, name, avatar_url}]}. Signed-in people only |
GET /comments/moderation/{status?} |
The queue (pending, spam, approved, deleted) for moderators, with meta.counts |
POST /comments/{id}/approve |
Approve a waiting or spam comment |
POST /comments/{id}/spam |
Hold a comment as spam |
POST /comments/{id}/reject |
Reject (delete) a comment |
GET /comments/{id} |
Permalink: redirects to the model's commentUrl() at the comment |
A comment looks like this:
{
"id": 12, "parent_id": 9, "depth": 1,
"author": { "name": "Maya Okafor", "initials": "MO", "avatar_url": null },
"body": "Existing price IDs work.", "html": "<p>Existing price IDs work.</p>\n",
"created_at": "2026-10-08T09:12:00+00:00", "edited_at": null,
"approved": true, "status": "approved", "deleted": false, "url": "https://app.test/comments/12",
"reactions": [{ "emoji": "❤️", "count": 3, "reacted": true, "names": ["Tom Reyes", "Inès Laurent", "Kenji Mori"] }],
"can": { "reply": true, "update": false, "delete": false, "react": true },
"replies": []
}
status is pending, approved or spam. Errors are JSON too: 401 for guests, 403 when a gate or a closed thread says no, 404 for unknown types or comments, 422 with errors.body for validation (or message for a post sent too quickly, or with too many links), and 429 when rate limited. A post the honeypot or a spam checker drops gets 202 with {"message": "Thanks."}.
Events
All in Ruvelo\Comments\Events, each with the $comment:
| Event | When |
|---|---|
CommentPosted |
A comment or reply is posted, approved or not (check $comment->isApproved()) |
CommentUpdated |
Its author edits it |
CommentDeleted |
It's deleted; $by is who did it, when known |
CommentApproved |
A moderator approves it |
CommentMarkedAsSpam |
It's held as spam: by a spam check when posted ($by is null), or by a moderator ($by) |
ReactionToggled |
Someone adds or removes a reaction: $reactor, $emoji, $added |
Exceptions
All extend CommentsException, and render themselves as the right HTTP response when thrown in a request: CommentingClosed, NotAllowed, NotCommentable, InvalidParent, InvalidComment (empty, too long, too many links), InvalidReaction, TooManyComments, PostedTooQuickly and SpamDetected (which the routes answer with 202, as if accepted).
Notifications
Ruvelo\Comments\Notifications\CommentPosted (new comments and replies) and MentionedInComment are regular notifications, sent through notifications.channels once a comment is published (straight away, or when a moderator approves it). toArray() returns title, body, url, icon, actor, kind, comment_id, commentable_type and commentable_id; toMail() is there for the mail channel. Nobody is notified twice for one comment, or about their own: a mentioned person gets the mention instead of the generic notification, and editing a comment only notifies people newly mentioned.
People can opt out. Give your user model a wantsCommentNotification() method, or register an app-wide check:
use Ruvelo\Comments\Notifications\CommentPosted; use Ruvelo\Comments\Notifications\MentionedInComment; class User extends Authenticatable { public function wantsCommentNotification(CommentPosted $notification): bool { return ! ($notification instanceof MentionedInComment && $this->mute_mentions); } } // AppServiceProvider::boot() Comments::notifyUsing(fn (User $user, CommentPosted $notification) => ! $user->is_suspended);
Someone who turns mentions off still hears about replies to their own comments. To change the wording, extend a class and name yours in notifications.classes.
Mentions
@handle is matched (ignoring case) by the resolver in mentions.resolver. The bundled Ruvelo\Comments\Mentions\ColumnResolver looks handles up in mentions.column of your user model and links to mentions.route or mentions.url:
'mentions' => [ 'resolver' => Ruvelo\Comments\Mentions\ColumnResolver::class, 'column' => 'username', // or 'handle', or 'name' if your names are one word 'url' => '/people/{handle}', // or 'route' => 'profile.show' ],
Handles are letters, digits and _, with . and - allowed inside. Mentions are stored in ruvelo_comment_mentions and kept in step when a comment is edited.
For anything else, implement MentionResolver (and SearchesMentions for the autocomplete):
use Ruvelo\Comments\Contracts\MentionResolver; use Ruvelo\Comments\Contracts\SearchesMentions; class TeamMentions implements MentionResolver, SearchesMentions { public function resolve(array $handles): array // lower-cased handle => model { return User::whereIn('slug', $handles)->get()->keyBy('slug')->all(); } public function url(Model $person): ?string { return route('people.show', $person); } public function search(string $prefix, int $limit): array { return User::where('slug', 'like', $prefix.'%')->orderBy('slug')->limit($limit)->get()->all(); } public function handle(Model $person): ?string { return $person->slug; } }
Or skip the class and pass closures, e.g. in AppServiceProvider::boot() (this replaces mentions.resolver):
Comments::resolveMentionsUsing( fn (array $handles) => User::whereIn('handle', $handles)->get()->keyBy('handle'), url: fn (User $user) => route('profile', $user), search: fn (string $prefix, int $limit) => User::where('handle', 'like', $prefix.'%')->limit($limit)->get(), handle: fn (User $user) => $user->handle, );
Mention autocomplete
The thread's form suggests people as you type @ once the resolver can search: a small listbox under the text box, with arrow keys, Enter or Tab to pick and Escape to close. It's on by default (mentions.autocomplete) and only shown to people who can comment.
In your own front end (Inertia, Vue, React, Livewire), call the same endpoint while the word before the cursor starts with @, and insert @handle when someone picks a person:
const response = await fetch('/comments/mentions?q=' + encodeURIComponent(query), { headers: { Accept: 'application/json' }, credentials: 'same-origin', }); const { data } = await response.json(); // [{ handle: 'maya', name: 'Maya Okafor', avatar_url: null }]
The endpoint is limited to 60 requests a minute per person and returns at most 8 matches, by handle prefix only.
In your tests
Comment::factory()->on($post)->by($user)->create(); Comment::factory()->replyTo($comment)->by($other)->pending()->create(); Comment::factory()->on($post)->by($user)->body('**Hi**')->edited()->create(); Comment::factory()->on($post)->by($user)->spam('Akismet')->create();
To test spam checks, fake Akismet's API: Http::fake([Ruvelo\Comments\Spam\Akismet::ENDPOINT => Http::response('true')]).
Using an AI coding agent?
The package ships Laravel Boost guidelines in resources/boost/guidelines/core.blade.php. With Boost installed (composer require laravel/boost --dev), run php artisan boost:install and pick ruvelo/laravel-comments from the third-party packages (or php artisan boost:update --discover if Boost is already set up). Your agent then knows how to make models commentable, show the thread, register commentable types, define the gates, set up mentions, notifications and spam checks, and use the JSON API, and what not to do.
Requirements
| Laravel | PHP | Tested in CI |
|---|---|---|
| 12 (12.4.1+) | 8.3, 8.4, 8.5 | yes |
| 13 | 8.3, 8.4, 8.5 | yes |
- Any database Laravel supports. The migrations are additive and portable (MySQL 5.7+, MariaDB, PostgreSQL, SQLite); tests run on SQLite
- Optional: ruvelo/laravel-inbox 1.1+ to show notifications in a bell and inbox, Filament 4 or 5 for the moderation resource, an Akismet key
Configuration reference
Publish the config file to change the defaults:
php artisan vendor:publish --tag=comments-config
| Key | Default | |
|---|---|---|
commentables |
[] |
Short name ⇒ model class. Only these (and morph map aliases) are accepted from requests |
path |
comments (COMMENTS_PATH) |
URL prefix for every route |
domain |
null |
Serve the routes on another (sub)domain |
middleware |
['web'] |
Applied to every route. The signed-in user is the session's |
routes |
true |
Set to false to register routes yourself (copy routes/web.php) |
max_depth |
2 |
Levels a thread shows: 1 is flat, 2 is comments and replies |
per_page |
20 |
Top-level comments per page; their replies always come along |
sort |
oldest |
Default order, oldest or newest. Readers can switch |
max_length |
5000 |
Characters per comment |
edit_window |
null |
Minutes authors may edit after posting; null for always |
require_approval |
false |
Hold new comments for a moderator |
rate_limit.max / .minutes |
5 / 1 |
Comments per author per window, through the routes. max => null turns it off |
rate_limit.ip_max |
20 |
Comments per IP address in the same window. null turns it off |
honeypot |
website |
Hidden field name; posts that fill it are dropped. null turns it off |
min_seconds |
3 |
Minimum seconds between showing the form and posting it. 0 turns it off |
max_links |
null |
Most links a comment may have (mentions don't count). null turns it off |
links_action |
hold |
Over max_links: hold for a moderator, or reject with a message |
spam.checkers |
[] |
SpamChecker classes, asked in order |
spam.akismet.enabled |
false (COMMENTS_AKISMET) |
Check comments with Akismet (needs a key) |
spam.akismet.key |
null (AKISMET_KEY) |
Your Akismet API key |
spam.akismet.site |
APP_URL (AKISMET_SITE) |
The site the key is registered for (Akismet's blog) |
spam.akismet.test |
false (AKISMET_TEST) |
Send is_test=1 while trying it out, so Akismet doesn't learn from it |
spam.akismet.timeout |
5 |
Seconds to wait for Akismet before letting the comment through |
reactions |
👍 ❤️ 🎉 😄 😮 😢 | The emoji people can react with; [] turns reactions off |
mentions.resolver |
null |
A MentionResolver class, e.g. ColumnResolver::class; null turns mentions off |
mentions.model / .column |
users model / username |
Where ColumnResolver looks handles up |
mentions.route |
null |
A route taking the person, e.g. profile.show, that mentions link to |
mentions.url |
null |
Or a URL pattern with {id} and {handle}, e.g. /people/{handle}. With neither, mentions are plain text |
mentions.autocomplete |
true |
Suggest people as you type @ (for resolvers that can search) |
notifications.enabled |
false (COMMENTS_NOTIFICATIONS) |
Send notifications |
notifications.channels |
['database'] |
Any Laravel channels, e.g. ['database', 'mail'] |
notifications.replies |
true |
Tell a comment's author about replies to it |
notifications.icons |
💬 / ↩️ / @ |
The inbox icon for each kind: comment, reply, mention. null shows the author's initials |
notifications.classes.comment / .mention |
CommentPosted / MentionedInComment |
Swap in your own notification classes (extend these) |
author_name_attribute |
name |
Shown for authors that don't implement CommentAuthor |
markdown.extensions |
[] |
Extra CommonMark extensions |
markdown.options |
[] |
CommonMark options. html_input and allow_unsafe_links can't be loosened |
layout |
null |
Your layout view for the moderation page; null uses the package's |
layout_section |
content |
The section the moderation page fills in your layout |
table_prefix |
ruvelo_ |
Tables are ruvelo_comments, ruvelo_comment_reactions and ruvelo_comment_mentions, clear of any comments table your app already has |
run_migrations |
true |
Set to false if you publish and run the migrations yourself |
If you published the config before 1.2, new top-level keys (min_seconds, max_links, links_action, spam) take their defaults automatically. New keys inside arrays you've published (rate_limit.ip_max, mentions.url, mentions.autocomplete, notifications.replies, .icons, .classes) behave as listed above when missing, except rate_limit.ip_max, which stays off until you add it.
Upgrading
From 1.1 to 1.2
Nothing breaks: 1.2 only adds. Three things to know:
- Run the migration.
php artisan migrateadds a nullablestatusandstatus_reasontoruvelo_commentsand createsruvelo_comment_mentions. It only adds columns and a table, and existing comments keep their meaning (a null status goes byapproved_at). If you setrun_migrationstofalse, publish the new migration first:php artisan vendor:publish --tag=comments-migrations. Until it runs, everything works as in 1.1, without spam holding or stored mentions. Long-running processes (queue workers, Octane) check for the new columns once, so restart them after migrating. - New defaults on the routes. A 3-second minimum time-to-submit (only for forms that send the new timestamp field, so published
form.blade.phpviews skip it until you re-publish or add the field), a limit of 20 comments per IP address per minute (only if your config has norate_limitarray of its own; published configs keep per-author limits only until you addip_max), and moderators now skip the honeypot and rate limits. Link limits and Akismet stay off until you set them. - Notification payloads have more keys:
icon,actor,kind,commentable_typeandcommentable_idjointitle,body,urlandcomment_id. Notification classes and types are unchanged, so existing notifications, inbox preferences andNotification::fake()assertions keep working.
If you published the views, re-publish them (php artisan vendor:publish --tag=comments-views --force) to get the Spam tab and buttons on the moderation page, the time-to-submit field and the mention autocomplete. Old views keep working without them.
Contributing
Pull requests are welcome. Clone, composer install, then composer check runs code style (Pint), static analysis (PHPStan level 8) and the tests, exactly as CI does. See CONTRIBUTING.md and the changelog.
The demo and screenshots are built from the package itself: composer demo writes the static demo into build/, and demo/screenshots.sh regenerates art/.
Credits
Built by François Bultez at Valtry, the website security scanner, and everyone who contributes.
License
MIT. See LICENSE.





