Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Comment

Laravel Comment Laravel Package

mll-lab/laravel-comment

Add comments to any Laravel Eloquent model with a reusable commentable trait, migrations, and a ready-made Comment model. Supports polymorphic associations and straightforward integration into existing apps.

View on GitHub
Deep Wiki
Context7

mll-lab/laravel-comment adds a flexible, polymorphic comment system to any Laravel application. Attach comments to Eloquent models through a simple trait, using a configurable comment model and publishable migrations that integrate cleanly with existing codebases.

  • Polymorphic relations let a single comments table serve any number of models
  • HasComments trait for quick setup on Eloquent models
  • Configurable comment model, table, and relationship names
  • Publishable migrations and configuration files
  • Built on native Laravel relationships, so no custom query layer is needed
Frequently asked questions about Laravel Comment
How do I install mll-lab/laravel-comment in a Laravel project?
Install it with Composer by requiring mll-lab/laravel-comment; version 2.0.0 requires PHP 8.2 or newer and Laravel 10, 11, 12, or 13. After installation, run the package migrations so the comments table exists, then add the provided trait to any Eloquent model that should receive comments. Check the repository README for the exact service provider registration and publish steps for your Laravel version.
Which Laravel and PHP versions does mll-lab/laravel-comment support?
Release 2.0.0 supports Laravel 10 through 13 and requires PHP 8.2 or higher. Laravel 9 and PHP 8.0 or 8.1 are no longer supported under that constraint set. If you are pinned to an older runtime, you will need to stay on the 1.x line or avoid the package entirely.
How do I attach comments to an existing Eloquent model?
Add the package's commentable trait to the model you want to comment on, along with the usual imports. The trait exposes a polymorphic relationship, so a single comments table can serve many different models without schema changes per type. Once the trait is in place you can create and query comments through that relationship rather than writing raw queries.
Does mll-lab/laravel-comment support polymorphic comments across multiple models?
Yes. Comments are stored polymorphically, meaning one comments table records the owning model type and key, and any model using the trait can have its own comments. This lets posts, pages, tasks, or other entities share the same commenting infrastructure. It is the main reason the package stays lightweight instead of generating per-model tables.
Do I need to publish and run migrations after installing?
You need the package's migrations applied before any comment can be stored, since the trait relies on the comments table being present. Typical setups either publish the migrations and run php artisan migrate, or let the package migrations load automatically depending on how the service provider is registered. Verify the migration state in a test database before wiring the trait into production models.
How do I create and query comments in code?
Create comments through the relationship the trait provides on your model, passing the body and any author information your schema supports. Query them by loading the relationship, or by using the comment model directly with standard Eloquent constraints. Because everything is ordinary Eloquent, eager loading and pagination work the same as any other relationship.
Is mll-lab/laravel-comment production ready, and is it actively maintained?
The 2.0.0 release targets Laravel 10 through 13 on PHP 8.2+, which shows the package is tracking current framework releases. That said, the major version bump lists only raised floors and added framework support, so review the changelog and commit history on GitHub before treating it as load-bearing. Confirm the release cadence and open issue count against your own maintenance policy.
What breaks when upgrading from 1.x to 2.0.0?
The published notes describe only the raised PHP and Laravel floors plus added Laravel 13 support, and do not enumerate breaking changes. A major version normally implies changes to configuration keys, service provider bindings, published assets, or return types, so generate a diff against the 1.x baseline before upgrading. The safest path is to install 2.0.0 on an isolated branch and run your full test suite before touching shared code.
Does the package include a UI, authentication, or comment moderation?
No. mll-lab/laravel-comment is a persistence and relationship layer: a trait, migrations, and polymorphic Eloquent access to comments. Rendering, authorization, spam filtering, and moderation workflows are left to your application. That keeps the package small, but it means you should budget for those features separately.
How does mll-lab/laravel-comment compare to other Laravel comment packages?
Its main differentiator is minimalism: one trait and one polymorphic table instead of a full commenting platform with controllers, views, and moderation tooling. That makes it a good fit when you already have your own UI and authorization and only need the data model. If you want a batteries-included comment system, compare against packages that ship routes, views, and admin tooling before deciding.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo