Download the PHP package alfonsobries/laravel-commentable without Composer

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

Laravel Commentable

A Laravel package to add comments to any model

Stable Version License PHP Version Require

Use

Installation

  1. Install the composer package:

  2. Publish the database migration

  3. Optionally publish the config file

  4. Configure the model that is going to receive the comments with the CommentableInterface contract and add the Commentable trait.

  5. Add the CanCommentInterface contract and the CanComment trait to the model that is going to add the comment (usually the User Model). Since you can add anonymous comments this is only necessary if you want to accept User comments.

Add comments

  1. Use the addComment method to add an anonymous comment

  2. Use the addCommentFrom method to add a comment from a User (or the model that implements the CanCommentInterface contract)

  3. You can also comment with the User model (or the model that implements the CanCommentInterface contract) by using the comment method.

Add replies to comments

  1. The Comment method is another commentable instance, meaning you can use the addComment or addCommentFrom method to add a reply.

  2. You can also use the reply and replyFrom methods that are just an alias for the comment methods above.

  3. Use the addCommentFrom method to add a comment from the User (or the model that implements the CanCommentInterface contract)

  4. You can also comment with the User model (or the model that implements the CanCommentInterface contract) by using the comment method.

Get comments

  1. You can get all the user comments with the comments method

  2. You can get all the comments associated with the commentable model with the comments method

Sort comments

Sort the comments by popularity (average positive likes) by using the popular and unpopular scope methods.

Update comments

Since the Comment object is just a regular Eloquent Model you can use any of the different ways to update the models.

Approving comments

By default, all the new comments are unapproved (approved_at=null), meaning that you need to approve them manually based on your specific needs (you can add an event listener based on the the events listed below to do that). If you don't need to handle approved and unapproved comments, you can simply ignore the filter when querying the comments.

You can filter the approved or not approved comments with the approved and notApproved methods.

Events

The Comment model fires the following events that you can listen:

Development

Analyze the code with phpstan

Refactor the code with php rector

Format the code with php-cs-fixer

Run tests

Security

If you discover a security vulnerability within this package, please write trough the https://alfonsobries.com contact form. All security vulnerabilities will be promptly addressed.

Credits

This project exists thanks to all the people who contribute.

License

Alfonso Bribiesca


All versions of laravel-commentable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^9.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 alfonsobries/laravel-commentable contains the following files

Loading the files please wait ....