PHPackages                             ssntpl/laravel-comments - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ssntpl/laravel-comments

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ssntpl/laravel-comments
=======================

Creating comments with information like text, date and type of comment along with user

v0.0.5(7mo ago)388MITPHPPHP ^7.4|^8.0

Since Jan 15Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/ssntpl/laravel-comments)[ Packagist](https://packagist.org/packages/ssntpl/laravel-comments)[ RSS](/packages/ssntpl-laravel-comments/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (5)Dependencies (2)Versions (8)Used By (0)

laravel-comments
================

[](#laravel-comments)

This is a simple package to associate comments with your eloquent model in laravel. This package is providing functionality for adding, retrieving, editing, and deleting comments along with its associated files if any on various entities:

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

[](#installation)

You can install the package via composer:

```
composer require ssntpl/laravel-comments
```

Run the migrations with:

```
php artisan migrate
```

Optionally, You can publish and run the migrations with:

```
php artisan vendor:publish --tag="laravel-comments-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

Add the `HasComments` trait to your model.

```
namespace App\Models;
use Ssntpl\LaravelComments\Traits\HasComments;

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

Add new comment to the model.

```
$model = Post::find(1);

$comment = $model->createComment([

    // type: Optional. It represents the type of comment.
    'type' => 'commentType',

    // text: This is text of the comment.
    'text' => 'The is the text of the comment',

    // user_id: Optional. This is a foreign key belonging to that entity who is making the comment. For e.g:Users(so it will be the id of User who is making the comment).
    'user_id' => 1,

    // created_at: The created_at timestamp is automatically managed by Eloquent. Represents the time at which the comment is made. Otherwise one can manually assign a value to created_at when creating a new comment.
    'created_at' => '2025-01-17 05:14:13',
]);
```

Accessing the comment model.

```
$card = Card::find(1);//comments can be added on a card

$card->comments; //return all the comments linked with the card

$card->comments() // returns the Illuminate\Database\Eloquent\Relations\MorphMany relation

$card->comments()->where('user_id',1)->get()  //Accessing all comments of the card made for particular user

$comment = $card->comments()->where('id',3)->first() // One can access the specific comment of card

// to create an attachment on that comment
$comment->createFile([
                    'key' => 'path/filename.jpg',
                    'name' => 'filename.jpg'
                ]);

$comment->file //To access the first or only attachment with that comment on the card

$comment->files //To access all the attachments related to that comment on that card

//One can update particular comment by adding id as one of the params
$card->createComment(['id' => 23, 'user_id' => 2,'text'=> "This is a new comment"])

//Like this one can delete all the comments along with its attachment on the card
$comments = $card->comments()->get();
foreach($comments as $comment) {
    $comment->delete();
}
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Jyotsana Sharma](https://github.com/JYOTSANASHARMAA)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance64

Regular maintenance activity

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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 ~77 days

Total

5

Last Release

216d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6224763?v=4)[Sword Software N Technologies Pvt. Ltd.](/maintainers/ssntpl)[@ssntpl](https://github.com/ssntpl)

---

Top Contributors

[![JYOTSANASHARMAA](https://avatars.githubusercontent.com/u/116160861?v=4)](https://github.com/JYOTSANASHARMAA "JYOTSANASHARMAA (10 commits)")

### Embed Badge

![Health badge](/badges/ssntpl-laravel-comments/health.svg)

```
[![Health](https://phpackages.com/badges/ssntpl-laravel-comments/health.svg)](https://phpackages.com/packages/ssntpl-laravel-comments)
```

###  Alternatives

[dantleech/fink

Checks Links

2266.5k2](/packages/dantleech-fink)[maantje/pulse-php-fpm

A Laravel Pulse card to show php-fpm status

46142.1k](/packages/maantje-pulse-php-fpm)[bitrix-expert/bbc-module

Module with classes for the basis components

1952.0k1](/packages/bitrix-expert-bbc-module)

PHPackages © 2026

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