Saltar al contenido
← Volver a proyectos

Laravel Crisp

Crisp for Laravel: render the live chat widget in your Blade layouts, with the settings stored in the database via spatie/laravel-settings.

Laravel Crisp

#Laravel Crisp

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

Add Crisp — live chat widget for customer support — to your Laravel app. The settings are stored in the database with spatie/laravel-settings, so you can change them at runtime (e.g. from an admin panel) instead of in .env.

For a Filament settings page, use jeffersongoncalves/filament-crisp.

#Installation

composer require jeffersongoncalves/laravel-crisp

Publish and run the settings migration:

php artisan vendor:publish --tag=crisp-settings-migrations
php artisan migrate

#Configuration

$settings = crisp_settings();
$settings->website_id = '3f2b8c1e-7a4d-4e5f-9b6a-1c2d3e4f5a6b';
$settings->save();

Or through the settings class or the Facade:

use JeffersonGoncalves\Crisp\Facades\Crisp;
use JeffersonGoncalves\Crisp\Settings\CrispSettings;

$settings = app(CrispSettings::class);
$value = Crisp::getFacadeRoot()->website_id;

#Available settings

Setting Type Default Description
website_id ?string null Your Crisp website id. The script only renders when it is valid.
identify_users bool false Send the signed-in user's name and email to the chat.
only_when_open bool false Hide the chat while laravel-open-hours says you're closed (ignored when it isn't installed).

#Identify users and opening hours

  • identify_users: sends the signed-in user's name and email to Crisp, so your agents see who they're talking to. Leave it off on pages served from a shared full-page cache.
  • only_when_open: with jeffersongoncalves/laravel-open-hours installed, the widget is only rendered while you're open.
composer require jeffersongoncalves/laravel-open-hours

#Usage

Add the script to your Blade layout, right before </body>:

@include('crisp::script')

Nothing is rendered until the settings are complete, so you can ship the include everywhere and turn Crisp on later.

#Testing

composer test

#Changelog

Please see CHANGELOG for more information on what has changed recently.

#Contributing

Please see CONTRIBUTING for details.

#Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

#Credits

#License

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

Nueva versión disponible.