NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

Require the package, then publish and run its migrations. The service provider is auto-discovered — no manual registration:

composer require roundly-consulting/comments-for-laravel

php artisan vendor:publish --tag="comments-migrations"
php artisan migrate

Migrations are publish-only — nothing is loaded from the package, so without the publish step php artisan migrate will not create the tables. The publish copies two migrations, each stamped with the publish time: create_comments_table, which creates the comments, comment_mentions and comment_locks tables, and add_meta_to_comments_table, which adds the nullable meta column (see Comment metadata). A file you already published is recognised by its content, so republishing with --force overwrites that same file instead of adding a second copy.

If the models you comment on use UUID or ULID keys, set COMMENTS_KEY_TYPE before you migrate — see Configuration.

Sibling package tables

Likes, Reports, Approvals and Media Library for Laravel are pulled in as hard dependencies and ship their own migrations. Publish and run them too, so comment likes, reports and attachments have somewhere to live:

php artisan vendor:publish --tag="likes-migrations"
php artisan vendor:publish --tag="reports-migrations"
php artisan vendor:publish --tag="approvals-migrations"
php artisan vendor:publish --tag="media-migrations"
php artisan migrate

Upgrading from 1.0

1.1.0 adds one migration, for the meta column. Publish the migrations again and migrate:

php artisan vendor:publish --tag="comments-migrations"
php artisan migrate

Your published create_comments_table is recognised by its content and left where it is; only add_meta_to_comments_table is added, with a newer timestamp. If you edited your published copy of create_comments_table, the publisher no longer recognises it and adds a second copy — delete that one before you migrate. Until you migrate, everything that doesn’t use meta keeps working: a comment written without metadata never names the column.

Upgrading to 1.2

1.2.0 adds no migration. CommentResource’s author.type is now the author’s class basename (User), never the stored actor_type — on an app without a morph map that was the full class name (App\Models\User), handed to every API client. Clients that matched on the old value need updating; to render a different author shape, swap comments.resources.author — see API resources.

Config & translations

The config file is optional — every key has a default. Publish it only to override. The messages ship in English and Slovak and load under the comments:: namespace without publishing — publish the language files only to reword them or add another language:

php artisan vendor:publish --tag="comments-config"
php artisan vendor:publish --tag="comments-translations"

The package exposes three publish tags: comments-migrations, comments-config and comments-translations.

Check the active setup

The package reports its active configuration to Laravel’s about command — model, approval, length and depth limits, blocklist size (a count, never the terms), authorization, auto-moderation and inline media:

php artisan about --only=comments

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

By donating, you agree to our donation terms.

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.