PHPackages                             fastcomments/laravel - 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. [API Development](/categories/api)
4. /
5. fastcomments/laravel

ActiveLibrary[API Development](/categories/api)

fastcomments/laravel
====================

Laravel integration for FastComments — Blade components, SSO, and API access

v1.0.0(2mo ago)00MITPHPPHP ^8.1CI passing

Since Mar 2Pushed 2mo agoCompare

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

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

FastComments for Laravel
========================

[](#fastcomments-for-laravel)

A Laravel package that wraps the [FastComments PHP SDK](https://github.com/FastComments/fastcomments-php) and [SSO library](https://github.com/FastComments/fastcomments-php-sso), providing Blade components, SSO integration, and full API access.

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12

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

[](#installation)

```
composer require fastcomments/laravel
```

Publish the configuration file:

```
php artisan vendor:publish --tag=fastcomments-config
```

Add your credentials to `.env`:

```
FASTCOMMENTS_TENANT_ID=your-tenant-id
FASTCOMMENTS_API_KEY=your-api-key
```

For EU region:

```
FASTCOMMENTS_REGION=eu
```

Blade Components
----------------

[](#blade-components)

### Comment Widget

[](#comment-widget)

```

{{-- With options --}}

```

### Live Chat

[](#live-chat)

```

```

### Comment Count

[](#comment-count)

```

```

SSO
---

[](#sso)

Enable SSO in your `.env`:

```
FASTCOMMENTS_API_KEY=your-api-key
FASTCOMMENTS_SSO_ENABLED=true
FASTCOMMENTS_SSO_MODE=secure
```

The API key is required for secure SSO — it is used to sign the SSO payload.

### Config-Based Mapping

[](#config-based-mapping)

In `config/fastcomments.php`, map FastComments fields to your User model attributes:

```
'sso' => [
    'enabled' => true,
    'mode' => 'secure',
    'user_map' => [
        'id' => 'id',
        'email' => 'email',
        'username' => 'name',
        'avatar' => 'profile.avatar_url', // dot notation supported
    ],
    'is_admin' => fn ($user) => $user->hasRole('admin'),
    'is_moderator' => fn ($user) => $user->hasRole('moderator'),
],
```

### Interface-Based Mapping

[](#interface-based-mapping)

For more control, implement the `MapsToFastCommentsUser` interface on your User model:

```
use FastComments\Laravel\SSO\Contracts\MapsToFastCommentsUser;

class User extends Authenticatable implements MapsToFastCommentsUser
{
    public function toFastCommentsUserData(): array
    {
        return [
            'id' => (string) $this->id,
            'email' => $this->email,
            'username' => $this->display_name,
            'avatar' => $this->avatar_url,
            'is_admin' => $this->hasRole('admin'),
        ];
    }
}
```

When the interface is implemented, it takes precedence over config-based mapping.

### SSO in Blade

[](#sso-in-blade)

When SSO is enabled, the `` component automatically injects SSO data for the authenticated user.

API Access
----------

[](#api-access)

### Via Facade

[](#via-facade)

```
use FastComments\Laravel\Facades\FastComments;

// Admin API (requires API key)
$comments = FastComments::admin()->getComments('tenant-id');

// Public API
$comments = FastComments::publicApi()->getCommentsPublic('tenant-id', 'url-id');

// SSO
$ssoPayload = FastComments::sso()->forWidget();
$token = FastComments::sso()->tokenFor($user);
```

### Via Dependency Injection

[](#via-dependency-injection)

```
use FastComments\Laravel\FastCommentsManager;

class CommentController extends Controller
{
    public function index(FastCommentsManager $fc)
    {
        $comments = $fc->admin()->getComments($fc->tenantId());
        // ...
    }
}
```

### Direct SDK Access

[](#direct-sdk-access)

```
use FastComments\Client\Api\DefaultApi;

class CommentController extends Controller
{
    public function index(DefaultApi $api)
    {
        $comments = $api->getComments('tenant-id');
        // ...
    }
}
```

Configuration Reference
-----------------------

[](#configuration-reference)

KeyEnv VariableDefaultDescription`tenant_id``FASTCOMMENTS_TENANT_ID``''`Your FastComments tenant ID`api_key``FASTCOMMENTS_API_KEY``''`API key for server-side calls`region``FASTCOMMENTS_REGION``null``null` (US) or `'eu'``sso.enabled``FASTCOMMENTS_SSO_ENABLED``false`Enable SSO`sso.mode``FASTCOMMENTS_SSO_MODE``'secure'``'secure'` or `'simple'``sso.login_url``FASTCOMMENTS_SSO_LOGIN_URL``null`Login URL (falls back to Laravel route)`sso.logout_url``FASTCOMMENTS_SSO_LOGOUT_URL``null`Logout URL (falls back to Laravel route)`widget_defaults`—`[]`Default widget config optionsCustomizing Views
-----------------

[](#customizing-views)

To customize the Blade template:

```
php artisan vendor:publish --tag=fastcomments-views
```

Templates will be published to `resources/views/vendor/fastcomments/`.

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance86

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

74d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/964724da95f174139b46cc74e50cea4df461899f6be6d383a8e111601afbc52d?d=identicon)[winrid](/maintainers/winrid)

---

Top Contributors

[![winrid](https://avatars.githubusercontent.com/u/1733933?v=4)](https://github.com/winrid "winrid (5 commits)")

---

Tags

laravelSSOcommentsfastcommentslive-commenting

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[neuron-core/neuron-laravel

Official Neuron AI Laravel SDK.

10710.0k](/packages/neuron-core-neuron-laravel)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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