PHPackages                             emmanuel-saleem/laravel-chatbot - 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. [Database &amp; ORM](/categories/database)
4. /
5. emmanuel-saleem/laravel-chatbot

ActiveLibrary[Database &amp; ORM](/categories/database)

emmanuel-saleem/laravel-chatbot
===============================

Laravel chatbot package for Q&amp;A, FAQ and support. Database-driven intents with keyword AND/OR matching, conditional replies, buttons and variable substitution. Works with Laravel 8–12 and integrates with BotMan (web driver) for web/embedded chat widgets.

1.0.6(5mo ago)045↓100%MITBladePHP &gt;=7.4

Since Nov 3Pushed 5mo agoCompare

[ Source](https://github.com/es-77/laravel-chatbot)[ Packagist](https://packagist.org/packages/emmanuel-saleem/laravel-chatbot)[ Docs](https://github.com/es-77/laravel-chatbot)[ RSS](/packages/emmanuel-saleem-laravel-chatbot/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (11)Used By (0)

Laravel Chatbot (Database-driven Q&amp;A + BotMan)
==================================================

[](#laravel-chatbot-database-driven-qa--botman)

A Laravel package that lets you manage chatbot Q&amp;A in the database, with keyword matching (AND/OR), conditions, variable substitution, BotMan integration, an admin UI, a minimal web chat, and a floating chat widget.

Project links and contact
-------------------------

[](#project-links-and-contact)

- Repository: [github.com/es-77/laravel-chatbot](https://github.com/es-77/laravel-chatbot)
- Maintainer (LinkedIn): [es77](https://www.linkedin.com/in/es77/?originalSubdomain=pk)
- Email: `emmanuelsaleem098765@gmail.com`

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- Laravel ^8|^9|^10|^11|^12

1) Install the package
----------------------

[](#1-install-the-package)

```
composer require emmanuel-saleem/laravel-chatbot
```

BotMan is included as a dependency. If you need the web driver explicitly:

```
composer require botman/driver-web:^1.5
```

2) Publish assets (config, migrations, views)
---------------------------------------------

[](#2-publish-assets-config-migrations-views)

Publish everything:

```
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider"
```

Or selectively:

```
# Config
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider" --tag=laravel-chatbot-config
# Migrations
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider" --tag=laravel-chatbot-migrations
# Views (UI)
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider" --tag=laravel-chatbot-views
```

3) Run migrations
-----------------

[](#3-run-migrations)

```
php artisan migrate
```

4) Routes
---------

[](#4-routes)

The package registers routes automatically:

- Web routes: admin pages and a BotMan endpoint
- API route: `POST /api/chatbot/message` for programmatic access

If you are using a test/breeze app, protect admin routes with `auth` as needed.

5) Admin UI
-----------

[](#5-admin-ui)

### Access Admin Pages

[](#access-admin-pages)

After installation, you can access the admin interface at:

- **All Questions**: `http://your-app.com/admin/bot-questions`
- **Create Question**: `http://your-app.com/admin/bot-questions/create`
- **Import Questions**: `http://your-app.com/admin/bot-questions/import`

Or use route helpers in your code:

```
route('bot-questions.index')      // List all questions
route('bot-questions.create')    // Create new question
route('bot-questions.import')    // Import questions from JSON
```

**Note:** Protect these routes with authentication middleware in your application. For example, in `routes/web.php`:

```
Route::middleware(['auth'])->prefix('admin/bot-questions')->group(function () {
    // Package routes are already registered, but you can wrap them
});
```

### Create Questions

[](#create-questions)

1. Navigate to **Create Question** (`/admin/bot-questions/create`)
2. Fill in the form:
    - **Question**: Descriptive text for your reference
    - **Keywords**: Add multiple keywords (press Enter or comma to add each keyword)
    - **Logic Operator**: Choose OR (any keyword matches) or AND (all keywords must match)
    - **Answer**: The bot's response (supports variables like `@{{user.name}}`, `@{{user.email}}`, `@{{session.deal_count}}`)
    - **Buttons** (optional): Add interactive buttons with labels and URLs
    - **Priority**: Higher numbers = higher priority (default: 0)
    - **Status**: Active/Inactive toggle
3. Click **Save** to create the question

### Import Questions

[](#import-questions)

1. Navigate to **Import Questions** (`/admin/bot-questions/import`)
2. Choose import method:
    - **Upload JSON File**: Select a JSON file from your computer
    - **Paste JSON Content**: Paste JSON directly into the textarea
3. Use the provided JSON structure format (see the import page for details)
4. Click **Import Questions** to process

**JSON Structure Example:**

```
[
  {
    "question": "What is your return policy?",
    "keywords": ["return", "refund", "policy"],
    "logic_operator": "OR",
    "answer": "We offer a 30-day return policy.",
    "priority": 10,
    "is_active": true,
    "buttons": [
      {
        "label": "Learn More",
        "url": "https://example.com/returns",
        "style": "primary",
        "target": "_blank"
      }
    ]
  }
]
```

### Question Features

[](#question-features)

Each question supports:

- **Keywords**: Tag input (press Enter or comma to add)
- **Logic Operator**: OR (any keyword) or AND (all keywords)
- **Variables in Answers**: `@{{user.name}}`, `@{{user.email}}`, `@{{session.deal_count}}`
- **Conditions** (optional): Match based on session/user data
- **Buttons** (optional): Interactive buttons rendered in chat responses

6) Web Chat page (included)
---------------------------

[](#6-web-chat-page-included)

The package includes a simple web chat at:

```
route('botman.web-chat')
```

This view posts to the BotMan controller and renders replies and buttons.

7) Floating chat widget (corner icon)
-------------------------------------

[](#7-floating-chat-widget-corner-icon)

Include the Blade snippet anywhere (typically at the end of your base layout before ``):

```
@include('laravel-chatbot::components.floating-chat')
```

The widget opens a compact chat panel and sends messages to the same BotMan web endpoint. No Tailwind required (uses inline styles).

8) API usage
------------

[](#8-api-usage)

Endpoint:

```
POST /api/chatbot/message
```

Payload:

```
{
  "message": "Hi",
  "session_data": {
    "deal_count": 3
  }
}
```

Response (example):

```
{
  "success": true,
  "data": {
    "matched": true,
    "question_id": 1,
    "message": "Hello John",
    "buttons": [
      { "label": "Join Call", "url": "https://...", "target": "_blank", "style": "primary" }
    ]
  }
}
```

See `API_USAGE.md` for more details.

9) Theme (dark/light) in test app
---------------------------------

[](#9-theme-darklight-in-test-app)

If you use the provided Breeze-based test app layout, a theme toggle is included in `resources/views/components/admin-layout.blade.php`. The theme persists in `localStorage('theme')` and toggles the `.dark` class.

10) Development tips
--------------------

[](#10-development-tips)

- After editing package views, if using them without publishing, just refresh. If you published views and you want to see updates, republish:

```
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider" --tag=laravel-chatbot-views --force
```

- Clear compiled views if needed:

```
php artisan view:clear
```

11) Quick copy commands
-----------------------

[](#11-quick-copy-commands)

```
# Install
composer require emmanuel-saleem/laravel-chatbot

# Publish all
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider"

# Or publish individually
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider" --tag=laravel-chatbot-config
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider" --tag=laravel-chatbot-migrations
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider" --tag=laravel-chatbot-views

# Migrate
php artisan migrate

# Clear compiled views (useful during dev)
php artisan view:clear
```

12) Troubleshooting
-------------------

[](#12-troubleshooting)

- If UI changes don't show after publishing, add `--force` when re-publishing views and clear compiled views: ```
    php artisan vendor:publish --provider="EmmanuelSaleem\LaravelChatbot\Providers\LaravelChatbotServiceProvider" --tag=laravel-chatbot-views --force
    php artisan view:clear
    ```
- For login-bound variables in the web chat, ensure Ajax requests include cookies. The default chat sends `credentials: 'same-origin'`.
- If you see "Unable to locate component \[admin-layout\]", the package includes a default admin layout. If you published views, ensure your published `admin-layout.blade.php` exists or remove it to use the package's default.

---

Happy building! If something feels rough, open an issue or send a PR.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance70

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

9

Last Release

174d ago

Major Versions

v0.1.1 → 1.0.02025-11-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc3c362ef1cde6e1a4164b254ddebd9b56f75dd87e95c86d50c67c62e1c3bc24?d=identicon)[Emmanuel saleem](/maintainers/Emmanuel%20saleem)

---

Top Contributors

[![es-77](https://avatars.githubusercontent.com/u/101662490?v=4)](https://github.com/es-77 "es-77 (16 commits)")

---

Tags

laravelpackagedatabaseqabuttonschatbotBotmanconditional-logiccustomer-supportsupport-botchat widgetlaravel-chatbotfaq botweb chatintent matchingvariable substitutionembedded chatchatbot integration

### Embed Badge

![Health badge](/badges/emmanuel-saleem-laravel-chatbot/health.svg)

```
[![Health](https://phpackages.com/badges/emmanuel-saleem-laravel-chatbot/health.svg)](https://phpackages.com/packages/emmanuel-saleem-laravel-chatbot)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)[awssat/laravel-sync-migration

Laravel tool helps to sync migrations without refreshing the database

10923.2k](/packages/awssat-laravel-sync-migration)[nathanheffley/laravel-watermelon

Easily set up a sync endpoint to support Watermelon DB in your Laravel projects.

6521.5k](/packages/nathanheffley-laravel-watermelon)[illuminatech/config

Provides support for Laravel application runtime configuration managed in persistent storage

14921.0k1](/packages/illuminatech-config)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
