PHPackages                             namest/commentable - 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. namest/commentable

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

namest/commentable
==================

v0.2.2(11y ago)012MITPHP

Since Mar 1Pushed 11y ago1 watchersCompare

[ Source](https://github.com/luuhoangnam/commentable)[ Packagist](https://packagist.org/packages/namest/commentable)[ RSS](/packages/namest-commentable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

Getting Started
===============

[](#getting-started)

Provide an *elegant way* to interact with comment feature between your eloquent models.

**Note**: The package is only support Laravel 5

Installation
============

[](#installation)

**Step 1**: Install package

```
composer require namest/commentable
```

**Step 2**: Register service provider in your `config/app.php`

```
return [
    ...
    'providers' => [
        ...
        'Namest\Commentable\CommentableServiceProvider',
    ],
    ...
];
```

**Step 3**: Publish package resources, include: configs, migrations. Open your terminal and type:

```
php artisan vendor:publish --provider="Namest\Commentable\CommentableServiceProvider"
```

**Step 4**: Migrate the migration that have been published

```
php artisan migrate
```

**Step 5**: Use some traits to make awesome things

```
class User extends Model
{
    use \Namest\Commentable\CommenterTrait;

    // ...
}

class Post extends Model
{
    use \Namest\Commentable\CommentableTrait;

    // ...
}
```

**Step 6**: Read API below and start *happy*

API
===

[](#api)

```
$user = \App\User::find(1);
$post = \App\Post::find(1);

$comment = $user->comment('Awesome')->about($post); // Return \Namest\Commentable\Comment instance
```

```
$users = \App\User::wasCommentedOn($post); // Return all user was commented on a post
$posts = \App\Post::hasCommentBy($user); // Get all posts that the user was leave comment on
```

```
$comments = \Namest\Commentable\Comment::by($user); // Return all comments that the user was leave
$comments = \Namest\Commentable\Comment::by($user, 'App\Post'); // Same as above but filter only comments on posts
```

```
$user->comments; // Return all comments that the user was leave
$user->commentables; // Return all commentable (in all types)
$post->commenters; // Return all commenters (in all types)
```

Censoring
=========

[](#censoring)

Set up censoring options in `config/commentable.php` file

Events
======

[](#events)

#### namest.commentable.prepare

[](#namestcommentableprepare)

When: Parepare for `$commenter` to leave a comment on the commentable and but before event `namest.commentable.commenting`

Payloads:

- `$commenter`: Who do this action
- `$message`: Comment message

Usage:

```
\Event::listen('namest.commentable.prepare', function ($commenter, $message) {
    // Do something
});
```

#### namest.commentable.commenting

[](#namestcommentablecommenting)

When: Before the `$commenter` leave a comment on the commentable but after the event `namest.commentable.prepare`

Payloads:

- `$commentable`: Which receive a comment from commenter
- `$message`: Comment message

Usage:

```
\Event::listen('namest.commentable.commenting', function ($commentable, $message) {
    // Do something
});
```

#### namest.commentable.commented

[](#namestcommentablecommented)

When: After the `$commenter` left a comment on the commentable

Payloads:

- `$comment`: Comment instance (you can get commenter &amp; commentable from comment instance by `$comment->commenter` &amp; `$comment->commentable`)

Usage:

```
\Event::listen('namest.commentable.commented', function ($comment) {
    // Do something
});
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

4

Last Release

4096d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b120d989836a5c37a0f9a2558a237d7c14325aa76ba60a24badc402296c220b?d=identicon)[luuhoangnam](/maintainers/luuhoangnam)

---

Top Contributors

[![luuhoangnam](https://avatars.githubusercontent.com/u/5616199?v=4)](https://github.com/luuhoangnam "luuhoangnam (27 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/namest-commentable/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[kirschbaum-development/commentions

A package to allow you to create comments, tag users and more

12369.2k](/packages/kirschbaum-development-commentions)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[glhd/special

1929.4k](/packages/glhd-special)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

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