PHPackages                             centrex/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. centrex/laravel-comments

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

centrex/laravel-comments
========================

Manage comments with livewire in laravel

v2.0.1(1mo ago)10MITPHPPHP ^8.3CI passing

Since Nov 13Pushed 1mo agoCompare

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

READMEChangelogDependencies (15)Versions (10)Used By (0)

Livewire Comments
=================

[](#livewire-comments)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5af1a214ffde31a37dc146590568b4feec31c81121d568e2a095d2f5c6858ac9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63656e747265782f6c697665776972652d636f6d6d656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/centrex/livewire-comments)[![GitHub Tests Action Status](https://camo.githubusercontent.com/4383e5f5379bf30ae6fcc83632a47da39588f5ee9113e054cfe223778c08350a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63656e747265782f6c697665776972652d636f6d6d656e74732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/centrex/livewire-comments/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/333771b1f75d20525436053ffe72421954ec79830059d11ca4eeb843edb44517/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63656e747265782f6c697665776972652d636f6d6d656e74732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/centrex/livewire-comments/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/b2b553a1439a634f0ee19eeb8e2d95ed47708ed02a56f8f64c3842a2583b3685/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63656e747265782f6c697665776972652d636f6d6d656e74733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/centrex/livewire-comments)

Real-time polymorphic comment threads built with Livewire. Supports nested replies, likes (by authenticated user or by IP/user-agent for guests), Markdown rendering, `@mention` linking, and soft-deletes.

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

[](#installation)

```
composer require centrex/livewire-comments
php artisan vendor:publish --tag="livewire-comments-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

### 1. Add the Livewire component to any Blade view

[](#1-add-the-livewire-component-to-any-blade-view)

```

```

The `$model` can be any Eloquent model — comments are stored polymorphically.

### 2. Add the `HasUserAvatar` trait to your User model (optional)

[](#2-add-the-hasuseravatar-trait-to-your-user-model-optional)

```
use Centrex\LivewireComments\Traits\HasUserAvatar;

class User extends Authenticatable
{
    use HasUserAvatar;
    // Provides avatar() → Gravatar URL based on email
}
```

### 3. Comment model

[](#3-comment-model)

```
use Centrex\LivewireComments\Models\Comment;

// All top-level comments for a model
Comment::parent()->where('commentable_type', Post::class)
    ->where('commentable_id', $post->id)
    ->with('children', 'user')
    ->get();

// Nested replies
$comment->children;    // ordered oldest-first
$comment->isParent();  // true if no parent_id

// Likes
$comment->likes_count;
$comment->isLiked();
$comment->removeLike();
```

### 4. Comment presenter

[](#4-comment-presenter)

```
$comment->presenter()->markdownBody();       // HtmlString (Markdown rendered)
$comment->presenter()->relativeCreatedAt();  // "2 hours ago"
$comment->presenter()->replaceUserMentions($text); // links @mentions to user profiles
```

### Config

[](#config)

```
php artisan vendor:publish --tag="livewire-comments-config"
```

```
// config/commentify.php
'users_route_prefix' => 'users',   // used for @mention links: /users/{username}
```

Testing
-------

[](#testing)

```
composer test        # full suite
composer test:unit   # pest only
composer test:types  # phpstan
composer lint        # pint
```

Changelog
---------

[](#changelog)

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

Credits
-------

[](#credits)

- [centrex](https://github.com/centrex)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance93

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 68.1% 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 ~113 days

Recently: every ~214 days

Total

9

Last Release

34d ago

Major Versions

v1.1.0 → v2.0.02025-10-29

PHP version history (4 changes)v1.0.0PHP ^8.1

v1.0.4PHP ^8.1|^8.2

v1.1.0PHP ^8.2|^8.3|^8.4

v2.0.1PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29769944?v=4)[Raisul Islam](/maintainers/rochi88)[@rochi88](https://github.com/rochi88)

---

Top Contributors

[![rochi88](https://avatars.githubusercontent.com/u/29769944?v=4)](https://github.com/rochi88 "rochi88 (49 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (15 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

laravellaravel-commentscentrex

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[venturedrake/laravel-crm

A free open source CRM built as a package for laravel projects

39910.0k](/packages/venturedrake-laravel-crm)[wearepixel/laravel-cart

A cart implementation for Laravel

1355.6k](/packages/wearepixel-laravel-cart)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.2k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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