Download the PHP package lenorix/laravel-comments without Composer

On this page you can find all versions of the php package lenorix/laravel-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 laravel-comments

Laravel Comments

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Associate comments with any Eloquent model. Comments can be nested (replies), reacted to with emoji, rendered from Markdown to sanitized HTML, held for moderation, mention other users, and notify people who subscribed to a model's comments.

Installation

Install the package via composer:

Publish and run the migrations:

Publish the config file:

Setup

Add the HasComments trait to any model that should receive comments, and implement commentableName() / commentUrl() — notifications use them to describe where a comment was posted:

If comments have an author (most apps do), prepare your user model and point the config at it:

If you want to allow comments from guests (no logged-in user), set:

Usage

Creating and reading comments

Replies

A Comment can itself receive comments, which makes it a reply:

Deleting a comment leaves its replies in place by default. Set delete_replies_along_comments to true in the config to delete them too, at every depth of nesting.

Reactions

Reacting always requires an identified commentator, even if allow_anonymous_comments is truereact() throws AnonymousReactionsNotAllowed when no commentator can be resolved. Guests can comment, but never react.

Only emoji listed in allowed_reactions are accepted — react() throws DisallowedReaction otherwise. Set allowed_reactions to an empty array to allow any reaction.

Markdown rendering and sanitizing

By default, original_text is rendered from Markdown into HTML and stored in text. Any HTML tag or attribute not on the sanitizer's whitelist is stripped. Extend that whitelist per tag in the config:

Use text to display a comment, and original_text when editing it.

Syntax highlighting for code blocks is not bundled. Add it by writing a CommentTransformer that runs after MarkdownToHtmlTransformer in comment_transformers and rewrites $comment->text with whichever highlighter your app already depends on.

Moderation

Register who can approve pending comments, and expose the signed approve/reject routes:

Override shouldBeAutomaticallyApproved() on a custom Comment subclass for fine-grained approval rules instead of the global config flag.

Notifications and subscriptions

All subscribers hear about every new approved comment on the model. Participating subscribers only hear about it if they have commented on that model themselves. The author of a comment is never notified about their own comment.

Customize the sender and the mail's content:

This publishes editable Blade templates to resources/views/vendor/comments/mail/. The pending-comment mail includes working approve/reject buttons.

Mentions

Mentions are represented as <span data-mention="{id}">{name}</span> inside the rendered text. Enable them and pick a raw-input convention (the default recognizes @[Name](id)):

Mentioned commentators are notified once the comment is approved, not while pending.

Authorization

The package ships a CommentPolicy, automatically bound to your configured Comment model. Extend it to customize create, update, delete, react, see, approve and reject rules:

Events

CommentCreated and CommentDeleted are dispatched from the Comment model's own created/deleted lifecycle, so they fire no matter how the row came to exist or disappear — a top-level comment, a reply, direct model calls, or the delete_replies_along_comments cascade all dispatch them:

CommentCreated fires even for a pending comment — check $event->comment->isApproved() if you only care about visible ones.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

Released into the public domain under The Unlicense.


All versions of laravel-comments with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0||^13.0
league/commonmark Version ^2.4
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 lenorix/laravel-comments contains the following files

Loading the files please wait ...