A non-intrusive support form that can be displayed on any page

Overview

A non-intrusive support bubble that can be displayed on any page

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Using this package you can quickly add a chat bubble that opens a support form on any page. It comes with batteries included:

  • TailwindCSS styling out of the box
  • Won't ask user information if there's a logged in user
  • Includes some meta data like URL and IP address
  • Easily extendable using custom views, language files and event listeners
  • Honeypot included and set-up to keep spammers at bay

You can see it in action below and on Flare!

support-small

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require spatie/laravel-support-bubble

Include TailwindCSS

The views included in this package all use TailwindCSS classes. We've stuck to the default Tailwind config classes. If you're not already using TailwindCSS, you can easily include it from their CDN:

">
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">

Add the component to your view

After installing the package, you need to add the Blade component in your relevant view files. If you want it to show up on all pages you can add it to your layout.blade.php file.

Next, you need to register the support form's route. Add the following macro in your routes/api.php file:

Route::supportBubble();

This will register a route at /support-bubble

⚠️ This package is not using CSRF tokens so make sure you add the route macro to your apps API routes or add an exclusion in the VerifyCsrfToken middleware.

// in app/Http/Middleware/VerifyCsrfToken.php

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

class VerifyCsrfToken extends Middleware
{
    protected $except = [
        'support-bubble',
        // other entries
    ];
    
    // ...
}

Configure message destination

Finally, you need to decide where you want to send the support bubble's submission to.

Out of the box, the package can mail the submissions to a given email address. To go this route, publish the config file and enter the email in mail_to.

Alternately, you can register an event listener to listen for the Spatie\SupportBubble\Events\SupportBubbleSubmittedEvent event and handle it yourself. This event has submitted form values as public properties.

The config file can be published with:

php artisan vendor:publish --provider="Spatie\SupportBubble\SupportBubbleServiceProvider" --tag="support-bubble-config"

These are the default contents of the published config file:

return [
    /*
     * Use this setting to completely disable the support bubble.
     */
    'enabled' => env('SUPPORT_BUBBLE_ENABLED', true),

    /*
     * The default route and controller will be registered using this route name.
     * This is a good place to hook in your own route and controller if necessary.
     */
    'form_action_route' => 'supportBubble.submit',

    /*
     * Enable or disable fields in the support bubble.
     * Keep in mind that `name` and `email` will be hidden automatically
     * when a logged in user is detected and `prefill_logged_in_user` is set.
     */
    'fields' => [
        'name' => true,
        'email' => true,
        'subject' => true,
        'message' => true,
    ],

    /*
     * When set to true we'll use currently logged in user to fill in
     * the name and email fields. Both fields will also be hidden.
     */
    'prefill_logged_in_user' => true,

    /*
     * If configured, we'll set-up an event listener that will
     * send any chat bubble responses to this e-mail address.
     *
     * Default: null
     */
    'mail_to' => null,

    /*
     * We can try to impersonate the user that submitted the support form.
     * The mail sent to the `mail_to` address will appear as if it came
     * from the email address that was submitted in the support form.
     *
     * This is useful when sending mails directly to a support desk.
     */
    'impersonate_mail_from_user' => false,
];

Customization options

The support bubble should look pretty good out of the box. However, we've documented a couple ways to customize labels, text, views and functionality.

Customizing form fields

It is currently not possible to add new fields to the support bubble's form. You can however disable any fields you do not like in the config file.

Customizing text / localisation

If you're just looking to customize the field labels, intro text or success text (after the form submitted), you can publish the package's language files:

php artisan vendor:publish --provider="Spatie\LaravelSupportBubble\LaravelSupportBubbleServiceProvider" --tag=support-bubble-translations

These published files can be found and changed in resources/lang/vendor/laravel-support-bubble/en/.

Customizing styles

You can customize the TailwindCSS classes used for the bubble pop-up, input fields and submit button by changing the support-bubble.class config keys. This is the ideal place to change the bubble's default purple color or use your own .input or .button classes.

You you're looking to change any more advanced styles, keep reading to learn how to publish and customize the Blade views used in the support bubble component.

Customizing views

You can publish and change all views (including the JavaScript code) in this package:

php artisan vendor:publish --provider="Spatie\LaravelSupportBubble\LaravelSupportBubbleServiceProvider" --tag=support-bubble-views

These published views can be found and changed in resources/views/vendor/laravel-support-bubble/.

Please keep in mind that it's not possible (or at least pretty difficult and convoluted) to add new fields to the support bubble.

Customizing support form destination

If you don't want to send the support messages to the mail_to email configured in the config file, you can define your own event listener and listen for the Spatie\SupportBubble\Events\SupportBubbleSubmittedEvent. The event contains all data submitted in the support form and can be used to, for example, make an API request to Freshdesk.

Customizing behaviour after submitting (advanced)

If you really want to, you can send the submitted form data to your own endpoint. The support form uses the route configured in the support-bubble.form_action_route config key. You can override this route by removing the Route::supportBubble() macro from your routes file and setting the form_action_route to any other route name in your application.

The incoming request on this route will be a \Spatie\SupportBubble\Http\Requests\SupportBubbleRequest.

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

Alternatives

If you need more options for your support bubble, consider using one of these:

License

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

You might also like...
PhpCodeAnalyzer scans codebase and analyzes which non-built-in php extensions used

PhpCodeAnalyzer PhpCodeAnalyzer finds usage of different non-built-in extensions in your php code. This tool helps you understand how transportable yo

IgAnalyzer - Find non-followers and potential stalkers.
IgAnalyzer - Find non-followers and potential stalkers.

igAnalyzer Features Shows mutual followers, non-followers and non-followings via pie chart Shows monthly followers via area chart Shows followers via

Cbe frontauth - A Textpattern plugin to manage backend connections from frontend and protect content from non-logged users

cbe_frontauth This client-side plugin lets your users (or you) manage backend connection from frontend, i.e. connect and disconnect as they (you) woul

PhpCodeAnalyzer scans codebase and analyzes which non-built-in php extensions used

PhpCodeAnalyzer PhpCodeAnalyzer finds usage of different non-built-in extensions in your php code. This tool helps you understand how transportable yo

Shortest Path - have a function ShortestPath (strArr) take strArr which will be an array of strings which models a non-looping Graph.

Have the function ShortestPath(strArr) take strArr which will be an array of strings which models a non-looping Graph

WARNING! This software is currently non-functional. - A system which makes installing Jexactyl far, far easier.
WARNING! This software is currently non-functional. - A system which makes installing Jexactyl far, far easier.

Jexactyl Assistant A system which makes installing Jexactyl far, far easier. WARNING 🚧 This software is currently in heavy alpha testing and WILL NOT

A PHP library that can be used manually as well as a CLI script that you can just run on your file

Run phpcs on files and only report new warnings/errors compared to the previous version. This is both a PHP library that can be used manually as well

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

It is a simple blog application coded with PHP, HTML, CSS. You can develop, edit. You can see it as a skeleton. ⚡
It is a simple blog application coded with PHP, HTML, CSS. You can develop, edit. You can see it as a skeleton. ⚡

PHP-BLOG-SYSTEM Simple blog system Features Adding Text Update Text Text Deletion User Login and register Bootstrap Design Profile Page How to use blo

Comments
  • Update support-bubble.blade.php

    Update support-bubble.blade.php

    This PR enables pointer-events to pass through the "support-bubble__container" padding which currently masks part of the viewport even when off-canvas.

    This fixes the way that it masks the scroll bar if present.

    opened by colinmackinlay 1
  • Adding RTL Support

    Adding RTL Support

    Sorry for the new PR, kind of messed up with the old one, so I had to close the old one, and repeat the process. However, the requested changes has been made. Sorry again.

    opened by koossaayy 1
  • Translatable submit button

    Translatable submit button

    This PR adds a missing translation of the Submit button (to mirror the translatable behavior of the rest of the form fields).

    This won't be a breaking change for people who updated to this patch after previously publishing the translation file.

    opened by wojciechgabrys 1
  • Adding RTL Supoort

    Adding RTL Supoort

    This pull request will add the RTL support to the bubble. Although it works when adding only,

    <html lang="ar-TN" dir="rtl" >
    

    I will see if I can tweak it more to work even without that.

    opened by koossaayy 0
Releases(1.3.1)
Owner
Spatie
We create products and courses for the developer community
Spatie
A robust and flexible way to add double-opt-in (DOI) to any form in Mautic

Mautic double-opt-in (DOI) plugin Adds a robust and flexible way to add a double-opt-in process (DOI) to any form in Mautic. What is the plugin for? I

Content Optimizer GmbH 11 Dec 29, 2022
Moodle ReactJS - gives you ability to use ReactJS inside any moodle page.

moodle-local_reactjs Moodle ReactJS - gives you ability to use ReactJS inside any moodle page. Note for devs: You'll need to set up npm dependencies d

SmartApp 5 Dec 14, 2022
Simple, modern looking server status page with administration and some nice features, that can run even on shared webhosting

Simple, modern looking server status page with administration and some nice features, that can run even on shared webhosting

Server status project 363 Dec 28, 2022
This Magento extension provides a Real Full Page Caching for Magento powered by Varnish with support of Session-Based information caching (Cart, Customer Accounts, ...) via ESI includes

This Magento extension provides a Real Full Page Caching (FPC) for Magento powered by Varnish with support of Session-Based information caching (Cart, Customer Accounts, ...) via ESI includes

Hugues Alary 95 Feb 11, 2022
salah eddine bendyab 18 Aug 17, 2021
Yclas Self Hosted is a powerful script that can transform any domain into a fully customizable classifieds site within a few seconds.

Yclas 4.4.0. Description Yclas self-hosted is a powerful script that can transform any domain into a fully customizable classifieds site within a few

Yclas 299 May 29, 2022
Revived of weareblahs/unifi-tv. Watch free channels by unifi TV on any 3rd party IPTV players that support MPEG-DASH + Widevine!

unifi-tv-revived Revived of weareblahs/unifi-tv. Watch free channels by unifi TV on any 3rd party IPTV players that support MPEG-DASH + Widevine! What

Sam Sam 6 Jun 14, 2022
Allows reflection of object attributes, including inherited and non-public ones

sebastian/object-reflector Allows reflection of object attributes, including inherited and non-public ones. Installation You can add this library as a

Sebastian Bergmann 6k Jan 4, 2023
search non profitable charity or organization through api search

Non Profile Charity Search Search non profitable organization or get the details of an organization Installation Require the package using composer: c

Touhidur Rahman 5 Jan 20, 2022
Automatically retry non-atomic upsert operation when unique key constraints are violated.

Laravel Retry on Duplicate Key Automatically retry non-atomic upsert operation when unique constraints are violated. e.g. firstOrCreate() updateOrCrea

mpyw 8 Dec 7, 2022