Download the PHP package anil/comments without Composer

On this page you can find all versions of the php package anil/comments. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package comments

anil/comments

A full-featured commenting system for Laravel. Attach comments to any Eloquent model with threaded replies, reactions, guest commenting, approval workflows, and a framework-agnostic UI — all in one package.

Features

Screenshots

Guest user (guest commenting enabled — name and email fields shown):

Logged-in user (comment form without guest fields, reply button visible):

Logged-out user (guest commenting disabled — authentication prompt shown):

Requirements

Installation

Setup

1. Add Commenter trait to your User model

2. Add Commentable trait to any model you want to comment on

3. Render the comments component in your view

That's it. The package auto-detects the authenticated user and renders the full comment UI.

Blade Component Options

Pagination

Pagination applies to top-level comments only. A parent comment and all of its replies count as one "page unit" — so perPage => 2 shows two parent comments plus all their children.

Nesting depth

By default replies nest up to level 3:

Replies beyond the max depth are shown at the deepest level. Override per-component with maxIndentationLevel or globally via config (max_depth).

Configuration

Publish the config file:

Key options in config/comments.php:

Key Default Description
model Comment::class Custom Comment model
reaction_model CommentReaction::class Custom reaction model
controller WebCommentController::class Custom controller
routes true Register package routes
load_migrations true Auto-load package migrations
approval_required false Require admin approval before comments are visible
guest_commenting true Allow unauthenticated users to comment
soft_deletes false Use soft deletes instead of hard deletes
max_depth 3 Maximum reply nesting level
sort 'latest' Default comment sort ('latest' or 'oldest')
reactions.enabled true Enable the reactions system
reactions.types ['like', 'dislike'] Allowed reaction types
rate_limiting.enabled true Enable rate limiting on comment submission
rate_limiting.max_attempts 10 Max submissions per window
rate_limiting.decay_minutes 1 Rate limit window in minutes
middleware ['web'] Middleware applied to comment routes
permissions Array Gate → policy method mappings
validation.* Array Override validation rules for each action
response_status Array HTTP status codes for create/update/delete
response_messages Array Response message strings

Publishing Assets

Authorization

The package registers Laravel gates backed by CommentPolicy:

Gate Default rule
create-comment Any authenticated user
edit-comment Comment author only
delete-comment Comment author or user with is_admin = true
reply-to-comment Any authenticated user (cannot reply to own comment)

You can override the gate-to-policy mappings in config/comments.php under permissions, or publish and modify CommentPolicy directly.

Reactions

Reactions are enabled by default. Each user can have one reaction per comment. Sending the same reaction type again removes it (toggle). Sending a different type switches it.

Configure types in config/comments.php:

Any string values are valid reaction types.

Guest Commenting

When guest_commenting is enabled, unauthenticated users can submit comments with a guest_name and guest_email. Honeypot spam protection (via spatie/laravel-honeypot) is automatically applied.

Disable guest commenting to show a login prompt instead:

Events

The package dispatches the following events (all implement SerializesModels for queued listeners):

Event Fired when
Anil\Comments\Events\CommentCreated A comment is created
Anil\Comments\Events\CommentUpdated A comment is edited
Anil\Comments\Events\CommentDeleted A comment is deleted

Register listeners in your EventServiceProvider as normal.

REST API

All routes are prefixed with /comments and named with comments.*.

Method URI Name Description
POST /comments comments.store Create a comment
PUT /comments/{comment} comments.update Edit a comment
DELETE /comments/{comment} comments.destroy Delete a comment
POST /comments/{comment} comments.reply Reply to a comment
POST /comments/{comment}/react comments.react Toggle a reaction

POST /comments

Guest fields (required when unauthenticated and guest commenting is enabled):

PUT /comments/{comment}

POST /comments/{comment} (reply)

POST /comments/{comment}/react

Returns:

Queryable Methods (Commentable trait)

These methods are available on any model using the Commentable trait:

Lifecycle Hooks

You can define these methods on your Comment model (after publishing and extending) or on your commentable model to run custom logic around comment operations:

Method Trigger
afterCreate() After a comment is created
afterUpdate() After a comment is updated
beforeDelete() Before a comment is deleted
afterDelete() After a comment is deleted
afterReply() After a reply is created

The service layer calls these hooks when they exist — no base implementation is required.

Localization

The package ships with translations for 13 locales:

ar, ca, de, en, es, fr, in, it, ja, nl, np, pt, ru

Publish translations to customize or add new locales:

Custom Controller

To extend or replace the controller, set the controller key in config:

Your controller must implement Anil\Comments\CommentControllerInterface or extend Anil\Comments\CommentController.

License

MIT — see LICENSE.


All versions of comments with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2|^8.3|^8.4|^8.5
erusev/parsedown Version ^1.7
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/pagination Version ^11.0|^12.0|^13.0
illuminate/routing Version ^11.0|^12.0|^13.0
illuminate/queue Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
spatie/laravel-honeypot Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package anil/comments contains the following files

Loading the files please wait ...