New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

spatie/laravel-there-there

Expose application data as JSON for There There
9,598 2
Install
composer require spatie/laravel-there-there
Latest Version:1.0.0
PHP:^8.3
Laravel:11 · 12 · 13
License:MIT
Last Updated:Oct 22, 2026
Links: GitHub  ·  Packagist
Maintainer: spatie

Expose application data as JSON for There There

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This package makes it easy to expose application data to There There. When a customer opens a ticket in There There, it will call your application to fetch relevant data and display it in the sidebar.

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-there-there

You can publish the config file with:

php artisan vendor:publish --tag="there-there-config"

This is the contents of the published config file:

return [
    'secret' => env('THERE_THERE_SECRET'),
    'url' => '/there-there',
    'middleware' => [
        Spatie\ThereThere\Http\Middleware\IsValidThereThereRequest::class,
        'api',
    ],
];

Add the secret to your .env file. You can find it in your There There workspace settings.

THERE_THERE_SECRET=your-secret-here

Usage

In a service provider (for example AppServiceProvider), register a sidebar callback using the ThereThere facade:

use Spatie\ThereThere\Facades\ThereThere;
use Spatie\ThereThere\SidebarItem;
use Spatie\ThereThere\Http\Requests\ThereThereRequest;

ThereThere::sidebar(function (ThereThereRequest $request) {
    $user = User::firstWhere('email', $request->email());

    if (! $user) {
        return [];
    }

    return [
        SidebarItem::markdown('Name', $user->name),
        SidebarItem::date('Registered at', $user->created_at),
        SidebarItem::numeric('Total orders', $user->orders()->count()),
        SidebarItem::boolean('Is subscribed', $user->subscribed()),
    ];
});

Each SidebarItem has a name, value, and type. The following types are available:

Type Method Value
numeric SidebarItem::numeric($name, $value) An integer or float
markdown SidebarItem::markdown($name, $value) A string (supports Markdown)
date SidebarItem::date($name, $value) A DateTimeInterface or ISO 8601 string
boolean SidebarItem::boolean($name, $value) A boolean

The package will respond with JSON in this format:

{
    "data": [
        {"name": "Name", "value": "John Doe", "type": "markdown"},
        {"name": "Registered at", "value": "2024-01-15T10:30:00+00:00", "type": "date"},
        {"name": "Total orders", "value": 42, "type": "numeric"},
        {"name": "Is subscribed", "value": true, "type": "boolean"}
    ]
}

Security

All requests are verified using HMAC-SHA256 signatures. The package will reject any request without a valid X-There-There-Signature header.

Testing

composer test

Changelog

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

Credits

License

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

Related Packages

spatie/elasticsearch-search-string-parser

Build Elasticsearch queries based of a query string

24,336 51
spatie/backtrace

A better backtrace

208,709,058 437
spatie/laravel-package-tools

Tools for creating Laravel packages

185,188,882 951
spatie/image-optimizer

Easily optimize images using PHP

93,761,798 2,882
spatie/error-solutions

This is my package error-solutions

83,359,997 66

Version History

Version Released PHP Laravel License
1.0.0 ^8.3 ^11.0||^12.0||^13.0 MIT
0.0.4 ^8.3 ^11.0||^12.0||^13.0 MIT
0.0.3 ^8.3 ^11.0||^12.0||^13.0 MIT
0.0.2 ^8.4 ^11.0||^12.0||^13.0 MIT
0.0.1 ^8.4 ^11.0||^12.0||^13.0 MIT