Download the PHP package newway-solutions/laravel-comments without Composer

On this page you can find all versions of the php package newway-solutions/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 Total Downloads

A Laravel package that provides a simple and flexible commenting system for your Laravel application. Add comments to any Eloquent model with support for nested replies, comment approval, and event-driven notifications.

Features

Requirements

Installation

You can install the package via composer:

Publish and Run Migrations

Publish the migration and run it:

Publish Configuration (Optional)

You can publish the config file with:

This will publish a config file to config/comments.php where you can customize the package behavior.

Configuration

Basic Configuration

The configuration file allows you to customize several aspects:

Usage

Preparing Your Models

Making Models Commentable

To allow a model to have comments, use the HasComments trait:

Making Users Able to Comment

For users to be able to comment, implement the Commentator contract and use the CanComment trait:

Basic Usage

Adding Comments

Retrieving Comments

Working with Nested Replies

Comment Management

Approving and Disapproving Comments

Deleting Comments

Advanced Usage

Using Query Scopes

Accessing Comment Relationships

Events

The package dispatches events when comments are created or deleted:

CommentAdded Event

CommentDeleted Event

Register your listeners in EventServiceProvider:

API Reference

HasComments Trait Methods

Method Description
comments() Returns all comments for the model
comment($comment) Add a comment as the authenticated user
commentAsUser($user, $comment) Add a comment as a specific user
replyToComment($parentComment, $comment, $user = null) Reply to an existing comment

Comment Model Methods

Method Description
approve() Approve the comment
disapprove() Disapprove the comment
commentable() Get the model that was commented on
commentator() Get the user who made the comment
parent() Get the parent comment (for replies)
replies() Get all replies to this comment

Query Scopes

Scope Description
approved() Get only approved comments

Database Structure

The package creates a comments table with the following structure:

Examples

Complete Example: Blog with Comments

Blade Template Example

Testing

Run the tests with:

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-comments with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.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 newway-solutions/laravel-comments contains the following files

Loading the files please wait ...