lakm/laravel-comments
Commenter is a feature-rich Laravel package for adding a complete commenting system to your app. Drop in the x-comments Blade component for any model, and manage comments with the included admin panel, themes, and moderation features.
Check your Livewire version before you run composer require. As of 4.1.0 the package requires Laravel 11/12/13, PHP 8.3+, and Livewire v4 — 4.1.0 explicitly dropped PHP 8.1/8.2, Laravel 10, and Livewire v3. If your app is still on Livewire 3, this is the single decision that determines whether you can use the current release at all.
composer require lakm/laravel-comments -W # -W lets Composer move Livewire to v4 if needed
php artisan commenter:install # publishes config, migrations, assets
php artisan migrate
Then wire up both sides of the relationship — the package is polymorphic, so any model can be commentable and any model can be a commenter:
use LakM\Commenter\Concerns\Commentable;
use LakM\Commenter\Contracts\CommentableContract;
class Post extends Model implements CommentableContract
{
use Commentable;
}
Repeat with Commenter / CommenterContract on User. Add @commenterStyles in <head> and @commenterScripts before </body>, then drop the component in a view:
<x-commenter::index :model="$post" />
Where to look first: the GitBook docs (lakm.gitbook.io/commenter) — the README's Overview section shows a stale <x-comments :model="$post" /> snippet that will not resolve; the Quick Start form with the :: namespace is the correct one. Second stop is the published config file from commenter:install, which is where auth-vs-guest mode and theme selection live. Third is the demo repo (laravel-comments-demo) — faster than the docs for seeing the full layout wiring.
First use case: a blog post detail page. One line replaces an entire bespoke comment system — editor, threading, reactions, pagination, moderation hooks.
Decide auth vs guest mode at install time, not later. The two are mutually exclusive per the feature list. Guest mode brings its own spam prevention and (since 2.0.0) email verification — which means mail deliverability becomes part of your commenting feature, so confirm your mailer is configured in staging before launch. Auth mode gives you reacted-users lists and mention functionality that guest mode doesn't.
Treat the component as a black box on the page. Everything after first render is Livewire. That means: don't wrap it in a Turbo/HTMX partial that swaps the DOM, don't put it inside a page-cache fragment, and don't assume a full page reload resets it. If your layout already runs Livewire, the component inherits your Livewire setup — nothing extra to wire.
Use the trait relations for read paths. For index pages that show comment counts, eager-load from the Commentable trait's relation rather than letting each row hydrate independently. The component handles its own pagination; your listing page should not duplicate that query.
Themes over CSS surgery. Assets ship precompiled (Tailwind v4 since 4.0.0). Switch themes per the docs rather than editing package styles — put any tweaks in a small app-level override stylesheet loaded after @commenterStyles, and keep view overrides in resources/views/vendor/commenter if you must change markup.
Admin panel is a separate install. lakm/laravel-comments-admin-panel is its own repo/package. If you already run Filament or Nova, weigh that against a second admin surface — you can build moderation into your existing panel against the package's models instead.
Feature surface you should not rebuild: threaded replies (3.0.0), pinning (4.0.0), reactions, mentions, dark mode, filtering/sorting. All are shipped UI. Your job is embedding, theming, and moderation policy — not reimplementing comment UX.
:: is load-bearing. <x-commenter::index> resolves the package component; <x-commenter> (or <x-comments>) makes Laravel look in your own resources/views/components and fails confusingly. The README explicitly warns about this, and its own Overview section then violates it.composer.json, and read the CHANGELOG before any minor bump — 4.1.0 alone dropped three platform versions.users table. On a fresh install, migrate after your own user migration; if ordering looks wrong, rename the published timestamps.commenter:install --force or vendor:publish) and clear caches before touching any CSS.php artisan config:clear after mode changes. Switching auth/guest or theme goes through the published config; a cached config in staging will silently ignore your edit.CommenterContract and not just the trait.How can I help you explore Laravel packages today?