PHPackages                             spatie/laravel-support-form - 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. spatie/laravel-support-form

ActiveLibrary

spatie/laravel-support-form
===========================

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

1.9.2(2mo ago)3932928MITPHPPHP ^8.2CI passing

Since Aug 26Pushed 3w ago3 watchersCompare

[ Source](https://github.com/spatie/laravel-support-bubble)[ Packagist](https://packagist.org/packages/spatie/laravel-support-form)[ Docs](https://github.com/spatie/laravel-support-bubble)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/spatie-laravel-support-form/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (11)Versions (32)Used By (0)

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

[](#a-non-intrusive-support-bubble-that-can-be-displayed-on-any-page)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c900d3337ec91e391bb75da949ccf2e62aafa9ac58a18adf61c392ed7c353353/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d737570706f72742d627562626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-support-bubble)[![Total Downloads](https://camo.githubusercontent.com/78a2f2b3f949ec3df054435e54fe1764f410a1a523ad8f12ff6dddf6163aaac8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d737570706f72742d627562626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-support-bubble)

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, on [Flare](https://flareapp.io/) and [Oh Dear](https://ohdear.app)!

[![support-small](https://user-images.githubusercontent.com/6287961/130991221-831879ee-1a90-46f3-a92d-af0e7a30d022.gif)](https://user-images.githubusercontent.com/6287961/130991221-831879ee-1a90-46f3-a92d-af0e7a30d022.gif)

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/52f3b64449f180160ef71c4775df7a5ac69bcada7c68f4e3a5b462b15a3bcd9d/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d737570706f72742d627562626c652e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-support-bubble)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

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](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Are you a visual learner?
-------------------------

[](#are-you-a-visual-learner)

In [this stream on YouTube](https://www.youtube.com/watch?v=IucDLJI2mvQ), you'll see how to install that package, and how it works under the hood.

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

[](#installation)

You can install the package via composer:

```
composer require spatie/laravel-support-bubble
```

#### Include TailwindCSS

[](#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:

```

```

If you use Tailwind [Just-in-Time Mode](https://tailwindcss.com/docs/just-in-time-mode) you should add these additional lines into your `tailwind.config.js` file:

```
content: [
    './vendor/spatie/laravel-support-bubble/config/**/*.php',
    './vendor/spatie/laravel-support-bubble/resources/views/**/*.blade.php',
    // other places
],
```

This way Tailwind JIT will build your styles including those properties used for the support bubble.

#### Add the component to your view

[](#add-the-component-to-your-view)

After installing the package, you need to add this 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
    ];

    // ...
}
```

In Laravel 11 this is done in `bootstrap/app.php`:

```
->withMiddleware(function (Middleware $middleware) {
        $middleware->validateCsrfTokens(except: [
			'support-bubble',
		]);
    })

```

#### Configure message destination

[](#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](https://laravel.com/docs/8.x/events#defining-listeners) 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:

```
