PHPackages                             nirajan/comment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. nirajan/comment

ActiveLibrary

nirajan/comment
===============

A Laravel package for handling comments

1.0.1(1mo ago)04MITBladePHP ^8.0

Since Mar 18Pushed 1mo agoCompare

[ Source](https://github.com/Nirajan14/comment)[ Packagist](https://packagist.org/packages/nirajan/comment)[ RSS](/packages/nirajan-comment/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Laravel Comment Package
=======================

[](#laravel-comment-package)

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![Laravel Version](https://camo.githubusercontent.com/73692ab0f1fac2901149539199fa738ac249d6cd2387048e8063666cfab3d736/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e7825323025374325323031312e7825323025374325323031322e782d7265642e737667)](https://laravel.com)

A simple, reusable Laravel package to add commenting functionality to any Eloquent model with minimal setup.

Features
--------

[](#features)

- **Polymorphic Support:** Add comments to any model (Posts, Products, etc.) using a single Trait.
- **Blade Components:** Includes ready-to-use components for comment forms and lists.
- **Admin Dashboard:** Built-in management interface at `/AdminActivity/comments`.
- **Security:** Integrated ReCAPTCHA validation support.
- **Moderation:** Optional comment approval system.
- **Customizable:** Easily configurable middleware, layouts, and routes.

---

Installation
------------

[](#installation)

### 1. Require the package via Composer

[](#1-require-the-package-via-composer)

```
composer require nirajan/comment
```

### 2. Publish Configuration and Migrations

[](#2-publish-configuration-and-migrations)

```
php artisan vendor:publish --provider="Nirajan\Comment\CommentServiceProvider"
```

### 3. Run Migrations

[](#3-run-migrations)

```
php artisan migrate
```

---

Configuration
-------------

[](#configuration)

After publishing, you can find the configuration file at `config/comment.php`.

```
return [
    'admin_middleware'   => ['web', 'admin'],
    'recaptcha_site_key' => env('RECAPTCHA_SITE_KEY'),
    'recaptcha_secret_key'=> env('RECAPTCHA_SECRET_KEY'),
    'admin_url_prefix'   => 'AdminActivity',
    'admin_layout'       => 'backend.layouts.master',
    'need_approval'      => false,
    'post_route' => [
        'name'     => 'posts.detail',
        'param'    => 'id',
        'callback' => null,
    ],
];
```

---

Usage
-----

[](#usage)

### 1. Prepare your Model

[](#1-prepare-your-model)

Add the `HasComments` trait to any model you want to allow comments on.

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Nirajan\Comment\Traits\HasComments;

class Post extends Model
{
    use HasComments;
}
```

### 2. Add Blade Components

[](#2-add-blade-components)

Insert the following components into your views (e.g., `show.blade.php`).

```

```

---

Admin Dashboard
---------------

[](#admin-dashboard)

You can manage, delete, and approve comments through the built-in dashboard: `your-domain.com/AdminActivity/comments`

*Note: Ensure your `admin_layout` in the config file matches your actual admin theme layout.*

---

License
-------

[](#license)

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

Contributing
------------

[](#contributing)

Feel free to submit issues or pull requests to improve this package.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75e9851a40cf1b4fe1639ba054c01be3f618637878636064bd530dc3ef8acb0b?d=identicon)[nirajanch\_](/maintainers/nirajanch_)

---

Top Contributors

[![Nirajan14](https://avatars.githubusercontent.com/u/74029766?v=4)](https://github.com/Nirajan14 "Nirajan14 (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nirajan-comment/health.svg)

```
[![Health](https://phpackages.com/badges/nirajan-comment/health.svg)](https://phpackages.com/packages/nirajan-comment)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
