emmanuel-saleem / laravel-chatbot
Laravel chatbot package for Q&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.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Blade
pkg:composer/emmanuel-saleem/laravel-chatbot
Requires
- php: >=7.4
- botman/botman: ^2.6
- botman/driver-web: ^1.5
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0
README
A Laravel package that lets you manage chatbot Q&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
- Repository: github.com/es-77/laravel-chatbot
- Maintainer (LinkedIn): es77
- Email:
emmanuelsaleem098765@gmail.com
Requirements
- PHP >= 7.4
- Laravel ^8|^9|^10|^11|^12
1) Install the package
composer require emmanuel-saleem/laravel-chatbot:@dev --prefer-source
BotMan is included as a dependency. If you need the web driver explicitly:
composer require botman/driver-web:^1.5
Prefer installing a tagged (stable) release
After you create a Git tag (see “Release a new version” below) and the version is available on Packagist, install without @dev:
composer require emmanuel-saleem/laravel-chatbot:^0.1.0
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
php artisan migrate
4) Routes
The package registers routes automatically:
- Web routes: admin pages and a BotMan endpoint
- API route:
POST /api/chatbot/messagefor programmatic access
If you are using a test/breeze app, protect admin routes with auth as needed.
5) Admin UI
After publishing views (optional), navigate to your admin routes. If you prefer the package views without publishing, use:
- All Questions:
route('bot-questions.index') - Create Question:
route('bot-questions.create')
Each question supports:
- Keywords: tag input (press Enter or comma)
- Logic operator: OR/AND
- Variables in answers:
@{{user.name}},@{{user.email}},@{{session.deal_count}} - Conditions (optional) against session/user data
- Buttons (optional) rendered in web chat responses
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)
Include the Blade snippet anywhere (typically at the end of your base layout before </body>):
@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
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
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 <html>.dark class.
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
# Install composer require emmanuel-saleem/laravel-chatbot:@dev --prefer-source # 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 printf "\nApplying migrations...\n" && php artisan migrate # Clear compiled views (useful during dev) php artisan view:clear
12) Troubleshooting
- If Composer fails because of stability: ensure your app allows installing
@devor require a specific commit/branch. - If UI changes don’t show after publishing, add
--forcewhen re-publishing views and clear compiled views. - For login-bound variables in the web chat, ensure Ajax requests include cookies. The default chat sends
credentials: 'same-origin'.
Happy building! If something feels rough, open an issue or send a PR.
Maintainers: Release a new version (no @dev installs)
- Choose the next semantic version (example: v0.1.0):
git add -A
git commit -m "chore(release): v0.1.0"
git tag v0.1.0
git push origin main --tags
- Ensure the package is on Packagist and auto-updates
- Create/claim on Packagist:
https://packagist.org/packages/submit - Package name should be
emmanuel-saleem/laravel-chatbot - Enable “auto-update via GitHub webhook” (recommended)
- Consumers can now install a stable tag (no @dev):
composer require emmanuel-saleem/laravel-chatbot:^0.1.0
Optional: organization/vendor move
If you plan to publish under an organization (e.g., es-77/laravel-chatbot), update composer.json:
{
"name": "es-77/laravel-chatbot",
"description": "A Laravel Chatbot package.",
"type": "library"
}
Then create the new package on Packagist and deprecate the old one, or set it to “Abandoned: use es-77/laravel-chatbot” in Packagist settings.
Badges (forks / issues / stars)
Add these to the top of the README (replace main if using another branch):
  