Download the PHP package x-laravel/commentable without Composer
On this page you can find all versions of the php package x-laravel/commentable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download x-laravel/commentable
More information about x-laravel/commentable
Files in x-laravel/commentable
Package commentable
Short Description Polymorphic comment system for Laravel Eloquent models with nested comment support.
License MIT
Informations about the package commentable
Commentable
A Laravel package that adds a polymorphic, infinitely nested comment system to any Eloquent model.
How It Works
- Any model can receive comments via the
Commentabletrait - Any model can post comments via the
Commentertrait - Replies can be nested to any depth
- Replies are lazy-loaded — fetch only what you need, when you need it
- Commenters are optional — anonymous comments are supported
Requirements
- PHP ^8.2
- Laravel ^12.0 | ^13.0
Installation
Run the migration:
Setup
Receiving comments
Add Commentable to any model that should receive comments:
Posting comments
Add Commenter to any model that should be able to post comments:
Usage
Adding a comment
Adding a reply
Replies can be added to any comment or reply. There is no depth limit.
Listing root comments
Chain relations as needed:
Listing replies (lazy-load)
Other relations
Soft deleting
Soft-deleting a parent comment does not cascade to its replies. If you want cascade-on-soft-delete behaviour, add a
deletingevent listener to your application.
Suggested API Design
Database
Testing
License
This package is open-sourced software licensed under the MIT license.
All versions of commentable with dependencies
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0