PHPackages                             towoju5/basement-chat - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. towoju5/basement-chat

ActiveLibrary[HTTP &amp; Networking](/categories/http)

towoju5/basement-chat
=====================

Add a real-time chat widget to your Laravel application.

v1.0.0.0(1y ago)04MITPHPPHP ^8.0

Since Dec 24Pushed 1y agoCompare

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

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

[![Basement Chat Logo](./assets/basement-chat.svg)](https://github.com/basement-chat/basement-chat)

Basement Chat
=============

[](#basement-chat)

Add a real-time chat widget to your Laravel application.

    basement-chat.webm     [ ![GitHub Workflow Test Status](https://camo.githubusercontent.com/b08546c0a1545eb50f0eb308608d747c60354dc9b32f90d2d6ec9079d8a0adad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f626173656d656e742d636861742f626173656d656e742d636861742f746573742e796d6c3f6c6162656c3d74657374266c6f676f3d676974687562267374796c653d666c617426636f6c6f723d336138326637266c6f676f436f6c6f723d7768697465) ](https://github.com/basement-chat/basement-chat/actions/workflows/test.yml?query=branch%3Amain) [ ![Code Coverage](https://camo.githubusercontent.com/5a95f3257c5840b067225bc045a749b773915fa6b4df6fdb9c2098bba27b7728/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f626173656d656e742d636861742f626173656d656e742d636861743f636f6c6f723d7768697465266c6f676f3d636f6465636f76267374796c653d666c6174266c6f676f436f6c6f723d7768697465) ](https://app.codecov.io/gh/basement-chat/basement-chat/) [ ![Packagist Version](https://camo.githubusercontent.com/bcb7ffe6604e8ff45a7618232bb403a3d0f059c5f78b6de61048ff40b206137e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626173656d656e742d636861742f626173656d656e742d636861743f636f6c6f723d336138326637266c6f676f3d7061636b6167697374267374796c653d666c6174266c6f676f436f6c6f723d7768697465) ](https://packagist.org/packages/basement-chat/basement-chat) [ ![Packagist License](https://camo.githubusercontent.com/c34336dd111b1dfff5e8d7537b030ab096e96d5de177f2e58d0f5c6e66af9122/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626173656d656e742d636861742f626173656d656e742d636861743f636f6c6f723d7768697465267374796c653d666c6174) ](https://github.com/basement-chat/basement-chat/blob/main/LICENSE.md) [ ![Semantic Release](https://camo.githubusercontent.com/a4b14f7961eee2e95947e71d2789d523e3178ebcbfc1118700e213eec40e075f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73656d616e7469632d2d72656c656173652d616e67756c61722d6531303037393f6c6f676f3d73656d616e7469632d72656c6561736526636f6c6f723d336138326637267374796c653d666c6174266c6f676f436f6c6f723d7768697465) ](https://www.conventionalcommits.org/)

 [![Built for](https://camo.githubusercontent.com/e36a3379d87fa0be06c6b5f9899262d66a3b474c56cfae856f1bf20b4efb139c/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d6275696c74253230666f72266d6573736167653d25323026636f6c6f723d7768697465267374796c653d666c6174266c6162656c436f6c6f723d7768697465)](https://camo.githubusercontent.com/e36a3379d87fa0be06c6b5f9899262d66a3b474c56cfae856f1bf20b4efb139c/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d6275696c74253230666f72266d6573736167653d25323026636f6c6f723d7768697465267374796c653d666c6174266c6162656c436f6c6f723d7768697465) [ ![Packagist Laravel Version](https://camo.githubusercontent.com/5ea5f6ec6574ac4daa34034fb76854c91700fb280be138172153bf99740f2035/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f626173656d656e742d636861742f626173656d656e742d636861742f6c61726176656c2f6672616d65776f726b3f6c6f676f3d6c61726176656c26636f6c6f723d336138326637267374796c653d666c6174266c6f676f436f6c6f723d7768697465) ](https://github.com/basement-chat/basement-chat/blob/main/composer.json) [![With](https://camo.githubusercontent.com/5780f9687386f87a24441e82639a283eb70390f1382bac24fd11d874a7ec3390/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d77697468266d6573736167653d25323026636f6c6f723d7768697465267374796c653d666c6174266c6162656c436f6c6f723d7768697465)](https://camo.githubusercontent.com/5780f9687386f87a24441e82639a283eb70390f1382bac24fd11d874a7ec3390/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d77697468266d6573736167653d25323026636f6c6f723d7768697465267374796c653d666c6174266c6162656c436f6c6f723d7768697465) [ ![Packagist PHP Version](https://camo.githubusercontent.com/66ca3b8f1dd1217a5e1f7ec66bb2e265221b00dce4805ca2fe61ce1ac0b690db/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f626173656d656e742d636861742f626173656d656e742d636861742f7068703f6c6f676f3d70687026636f6c6f723d336138326637267374796c653d666c6174266c6f676f436f6c6f723d7768697465) ](https://github.com/basement-chat/basement-chat/blob/main/composer.json)

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Features](#features)
- [Demo](#demo)
- [Installation](#installation)
- [Configurations](#configurations)
- [Advanced Customizations](#advanced-customizations)
- [Extra Notes and Troubleshooting](#extra-notes-and-troubleshooting)
- [Roadmap](#roadmap)
- [Contributing](#contributing)
- [License](#license)

Introduction
------------

[](#introduction)

With this package, you can enhance user engagement, boost collaboration, and facilitate instant communication within your existing Laravel application by providing seamlessly integrated dynamic and interactive real-time chat widget functionality.

 TriviaThe Basement name was inspired by Aech's private chat room from [Ready Player One](https://readyplayerone.fandom.com/wiki/Basement).

Features
--------

[](#features)

- Real-time messages
- User's online status
- User's typing indicator
- Messages have been read status
- Configurable push notifications from the client side
- Searchable contacts and messages
- Extendable and customizable actions behavior
- Lazy loading with infinite scroll messages
- Intuitive and attractive design using TailwindCSS and Alpine.js
- Can be used with various CSS frontend frameworks such as Bootstrap and TailwindCSS without worrying about style conflicts
- Flexible broadcast driver support, [Pusher](https://pusher.com/), [Ably](https://ably.com/), [Soketi](https://docs.soketi.app/), [Laravel Websockets](https://beyondco.de/docs/laravel-websockets/), or any other Laravel supported broadcast driver, it's up to you to decide.

Demo
----

[](#demo)

[Here is a demo](https://github.com/basement-chat/demo) with scaffolding using Laravel Breeze.

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

[](#installation)

### Requirements:

[](#requirements)

- Server-side: `php ^8.0` and `laravel/framework ^9.0.0 | ^10.0.0` installed in your project.
- Client-side: `chrome >= 80`, `edge >= 80`, `firefox >= 74`, or equivalent. See details [here](https://browsersl.ist/#q=chrome+%3E%3D+80%2C+edge+%3E%3D+80%2C+firefox+%3E%3D+74%2C+maintained+node+versions).

### Installation steps:

[](#installation-steps)

- Open a terminal, and make sure you are in your Laravel project directory.
- Install this package using the following command:

    ```
    composer require basement-chat/basement-chat

    ```
- Start integrating Basement Chat with your Laravel application:

    ```
    php artisan basement:install

    ```

    > The above command will publish the configuration, assets, and migration files to your Laravel application. On the other hand, it will also ask interactive questions for you to run the database migrations and ask you to install which broadcast driver you will use.
- Selecting a broadcast driver

    Before selecting a broadcast driver, you need to ensure that `BroadcastServiceProvider::class` is enabled by uncommenting it or adding it to your `providers` in `config/app.php`:

    ```
    /*
     * Application Service Providers...
     */
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    - // App\Providers\BroadcastServiceProvider::class,
    + App\Providers\BroadcastServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,
    ```

    Then you can select one of the following drivers:

    > If you accidentally missed installing the driver in the previous step, you can install it again using the `php artisan basement:install driver` command.

    - [Pusher](https://pusher.com/) (Click here to expand)After creating a new channel in the Pusher account, you need to configure Laravel `.env` by providing the relevant configurations:

        ```
        BASEMENT_BROADCAST_DRIVER=pusher
        BROADCAST_DRIVER=pusher
        PUSHER_APP_ID=
        PUSHER_APP_KEY=
        PUSHER_APP_SECRET=
        PUSHER_APP_CLUSTER=
        ```
    - [Ably](https://ably.com/) (Click here to expand)Provide relevant configurations in your `.env` after creating a new app in your Ably account:

        ```
        BASEMENT_BROADCAST_DRIVER=ably
        BROADCAST_DRIVER=ably
        ABLY_KEY=
        ABLY_PUBLIC_KEY=
        ```
    - [Soketi](https://docs.soketi.app/) (Click here to expand)Configure your `.env` first with the following configuration:

        ```
        BASEMENT_BROADCAST_DRIVER=soketi
        BROADCAST_DRIVER=pusher
        PUSHER_APP_ID=app-id
        PUSHER_APP_KEY=app-key
        PUSHER_APP_SECRET=app-secret
        PUSHER_HOST=127.0.0.1
        PUSHER_PORT=6001
        PUSHER_SCHEME=http
        ```

        Then, keep the Soketi server running with the following command when you want to use chat features in your app:

        ```
        npx soketi start

        ```
    - [Laravel Websockets](https://beyondco.de/docs/laravel-websockets/) (Click here to expand)Similar to Soketi, you need to configure `.env` first with the following configuration:

        ```
        BASEMENT_BROADCAST_DRIVER=laravel-websockets
        BROADCAST_DRIVER=pusher
        PUSHER_APP_ID=app-id
        PUSHER_APP_KEY=app-key
        PUSHER_APP_SECRET=app-secret
        PUSHER_HOST=127.0.0.1
        PUSHER_PORT=6001
        PUSHER_SCHEME=http
        ```

        Then, keep the Laravel Websockets server running with the following command when you want to use chat features in your app:

        ```
        php artisan websockets:serve

        ```
- Configure your Sanctum Stateful Domains

    Since this package uses [Laravel Sanctum](https://laravel.com/docs/10.x/sanctum) as the primary authentication system, you will need to configure your `.env` to use the equivalent `SANCTUM_STATEFUL_DOMAINS` with the domain you are currently using:

    ```
    SANCTUM_STATEFUL_DOMAINS=

    ```

    > Example: `basement.up.railway.app`, `127.0.0.1:8080`
- Implements Basement Chat functionality to your user model

    In your user model (by default uses `app/Models/User.php`), modify it so it implements `BasementChat\Basement\Contracts\User` and uses `BasementChat\Basement\Traits\HasPrivateMessages` trait

    ```
