Installation

Wirechat is a simple yet robust chat package built with the TALL Stack, making it easy to integrate into your Laravel app with just a few commands.


#Prerequisites

Before you begin, ensure the following are installed:

  • PHP version 8.2 or later
  • Laravel version 10 or later
  • Livewire version 3.2.3 or later
  • Tailwindcss 4.x+

#Installing

#1. Require composer package

Before installing, ensure that authentication is already set up in your application. You may use built in laravel authenticated

Since wirechat v0.3+ is still in beta, make sure your composer.json allows beta packages by setting minimum-stability to beta. You can do this manually or via the CLI:

composer config minimum-stability beta

Your composer.json should now include:

{
    "minimum-stability": "beta"
}

Require the package

composer require wirechat/wirechat:"^0.3"

#2.Install Wirechat:

Run this command to install and publish the necessary files:

php artisan wirechat:install

The following actions will be executed:

  • Publish configuration file
  • Publish migration files
  • Create a default panel
  • Create a storage symlink

The wirechat:install command will also create a default panel at app/Providers/Wirechat/ChatsPanelProvider.php , so you can go ahead and start Configuring your panel and get ready for chatting

#3. Run Migrations:

Enable UUIDs before running migrations (Optional)

If you want Wirechat to use UUIDs instead of auto-incrementing integers for conversations, update the config before running migrations:

// config/wirechat.php
'uses_uuid_for_conversations' => true,

🔶 Important: This setting should only be configured during initial setup and before running any migrations. Once the tables are created, switching between UUIDs and integers is not supported and may break existing data.

Finally Apply the necessary database migrations with:

php artisan migrate

#Setup Tailwind CSS

Wirechat v0.3 requires Tailwind CSS v4.0 or later.

If you already have Tailwind installed in your project, just add the following configuration to your resources/css/app.css file:

/* resources/css/app.css */
@import '../../vendor/wirechat/wirechat/resources/css/app.css';

#WebSockets and Queue Setup

Wirechat uses WebSockets to broadcast messages in real-time to conversations and their participants.

Step 1: Enable Broadcasting

In newer Laravel installations, broadcasting is disabled by default. To enable it, run:

php artisan install:broadcasting

Note: This command will prompt you to install Laravel Reverb and necessary front-end packages such as Echo. Accept if you don’t yet have a WebSocket server set up.

Then, start your Reverb server:

php artisan reverb:start

For more details, refer to the Laravel Broadcasting Documentation, including information on integrating Laravel Echo for real-time updates.

Step 2: Start Your Queue Worker

After configuring broadcasting, start a queue worker to handle message broadcasting and other queued tasks:

php artisan queue:listen --queue=messages,default
Queue Prioritization

Wirechat uses two queues for efficient delivery:

  1. High Priority (messages): For real-time broadcasting of messages to users in a conversation.
  2. Default Priority (default): For notifications like updating chat lists or showing unread message counts.

To customize these queue names Navigate to your panel and set up queues

use Wirechat\Wirechat\Panel;

public function panel(Panel $panel): Panel
{
return $panel
    //...
    ->messagesQueue('messages')
    ->eventsQueue('default');
}

Step 3: Step Development Server

To start your development server, run:

composer run dev

If you're not running the latest Laravel version, you can run: php artisan serve && npm run dev seperately

For more details, see Laravel's Tailwind and Composer Dev Command Documentation.


#Publishing Translations

If you need to customize the language files, you can publish them using the following command:

php artisan vendor:publish --tag=wirechat-translations

#Publishing Views

To modify Wirechat's Blade views, publish them with this command:

php artisan vendor:publish --tag=wirechat-views