PHPackages                             patel/chatbot-bundle - 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. [Framework](/categories/framework)
4. /
5. patel/chatbot-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

patel/chatbot-bundle
====================

A reusable Symfony chatbot bundle

v1.0.4(9mo ago)012MITCSSPHP &gt;=8.2

Since Jun 9Pushed 9mo agoCompare

[ Source](https://github.com/niravpateljoin/ChatbotBundle)[ Packagist](https://packagist.org/packages/patel/chatbot-bundle)[ RSS](/packages/patel-chatbot-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (6)Used By (0)

---

Chatbot Bundle
==============

[](#chatbot-bundle)

A Symfony bundle that provides a menu-based chatbot widget with category management and FAQ functionality. The chatbot appears as a floating button on the right side of your website and allows users to browse categories and get answers to frequently asked questions.

---

Features
--------

[](#features)

- 🤖 Interactive chatbot widget
- 📁 Category management system
- ❓ FAQ management with category-wise organization
- 🎨 Floating button interface design
- 🔧 Easy integration with existing Symfony projects

---

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

[](#installation)

### Step 1: Add Configuration

[](#step-1-add-configuration)

Create the file `config/packages/chatbot.yaml`: Create the file config/packages/chatbot.yaml and set the user\_question\_entity parameter to the fully qualified namespace of your user question entity class.

```
chatbot:
    role: ROLE_CHATBOT_ADMIN
    user_question_entity: App\Entity\UserQuestion
```

### Step 2: Install the Bundle

[](#step-2-install-the-bundle)

Install the chatbot bundle using Composer:

```
composer require patel/chatbot-bundle
```

### Step 3: Register the Bundle

[](#step-3-register-the-bundle)

Add the bundle to your `config/bundles.php` file:

```
return [
    // ... other bundles
    Chatbot\ChatbotBundle::class => ['all' => true],
];
```

### Step 4: User-Submitted Questions

[](#step-4-user-submitted-questions)

Users can submit their own questions through the chatbot. Admins can respond and choose to publish them in the FAQ. Users receive email notifications when their question is answered.

### Implement `ChatbotUserInterface`

[](#implement-chatbotuserinterface)

In your user entity (e.g., `Admin`):

```
use Chatbot\Security\ChatbotUserInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

class Admin implements ChatbotUserInterface
{
    #[ORM\OneToMany(mappedBy: 'user', targetEntity: UserQuestion::class)]
    private Collection $questions;

    public function __construct()
    {
        $this->questions = new ArrayCollection();
    }

    public function getQuestions(): Collection
    {
        return $this->questions;
    }
}
```

### Create a `UserQuestion` Entity

[](#create-a-userquestion-entity)

```
namespace App\Entity;

use Chatbot\Entity\ChatbotUserQuestion as BaseQuestion;
use Chatbot\Security\ChatbotUserInterface;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: 'chatbot_user_question')]
class UserQuestion extends BaseQuestion
{
    #[ORM\ManyToOne(targetEntity: Admin::class, inversedBy: 'questions')]
    #[ORM\JoinColumn(nullable: false)]
    private ChatbotUserInterface $user;

    public function getUser(): ChatbotUserInterface
    {
        return $this->user;
    }

    public function setUser(ChatbotUserInterface $user): static
    {
        $this->user = $user;
        return $this;
    }
}
```

### Create a `UserQuestionRepository` Repository

[](#create-a-userquestionrepository-repository)

```
declare(strict_types=1);

namespace App\Repository;

use App\Entity\UserQuestion;
use Chatbot\Repository\UserQuestionRepositoryInterface;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
 * @extends ServiceEntityRepository
 */
class UserQuestionRepository extends ServiceEntityRepository implements UserQuestionRepositoryInterface
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, UserQuestion::class);
    }
}
```

### Configure Email Notifications

[](#configure-email-notifications)

Set the `FROM_EMAIL` in your `.env`:

```
FROM_EMAIL="your@email.com"
```

### Step 5: Install Assets

[](#step-5-install-assets)

```
php bin/console assets:install --symlink
```

This will publish necessary asset files to the `public/bundles/` directory.

### Step 6: Create and Run Migrations

[](#step-6-create-and-run-migrations)

Generate and execute the database migrations:

```
php bin/console make:migration
php bin/console doctrine:migrations:migrate
```

### Step 7: Include the Chatbot Widget and isUserLoggedIn

[](#step-7-include-the-chatbot-widget-and-isuserloggedin)

Include the widget in your base template (`templates/base.html.twig`):

```

    {{ include('@Chatbot/chatbot_widget.html.twig') }}

```

Add in script tag:

```

    const isUserLoggedIn = {{ app.user is not null ? 'true' : 'false' }};

```

### Step 8: Add Routes

[](#step-8-add-routes)

Add the following to `config/routes.yaml`:

```
chatbot_bundle:
  resource: '@ChatbotBundle/Resources/config/routes.yaml'
```

### Step 9: Add in your services.yaml

[](#step-9-add-in-your-servicesyaml)

```
Chatbot\Repository\UserQuestionRepositoryInterface: '@App\Repository\UserQuestionRepository'
```

---

Usage
-----

[](#usage)

### Category Management

[](#category-management)

Visit `/chatbot/category` to:

- Add new categories
- Edit or delete existing ones

### FAQ Management

[](#faq-management)

Visit `/chatbot/faq` to:

- Add new FAQs with answers
- Edit or remove outdated questions
- Assign FAQs to categories

### User Interaction

[](#user-interaction)

- Users click the chatbot button on the website
- Categories are shown
- Clicking a category reveals related FAQs
- Users can ask their own questions

---

Customizing Templates
---------------------

[](#customizing-templates)

### Step 1: Locate Original Templates

[](#step-1-locate-original-templates)

- `vendor/patel/chatbot-bundle/src/Resources/views/category/`
- `vendor/patel/chatbot-bundle/src/Resources/views/faq/`

### Step 2: Create Override Directories

[](#step-2-create-override-directories)

```
mkdir -p templates/bundles/ChatbotBundle/category
mkdir -p templates/bundles/ChatbotBundle/faq
```

### Step 3: Copy Templates

[](#step-3-copy-templates)

```
cp vendor/patel/chatbot-bundle/src/Resources/views/category/index.html.twig templates/bundles/ChatbotBundle/category/
cp vendor/patel/chatbot-bundle/src/Resources/views/faq/index.html.twig templates/bundles/ChatbotBundle/faq/
```

### Step 4: Clear Cache

[](#step-4-clear-cache)

```
php bin/console cache:clear
```

---

Available Routes
----------------

[](#available-routes)

PathNamePurpose`/chatbot``chatbot`Chatbot homepage`/chatbot/user-questions``chatbot_user_questions_index`Manage user-submitted questions`/chatbot/category``chatbot_category_index`Manage categories`/chatbot/faq``chatbot_faq_index`Manage FAQs`/chatbot/widget``chatbot_widget`Display chatbot widget`/chatbot/faqs/{categoryid}``chatbot_faqs_by_category`Get FAQs by category (AJAX/API)---

Flow Diagram
------------

[](#flow-diagram)

### 1. 📂 Category Management (Admin Panel)

[](#1--category-management-admin-panel)

[![Category CRUD](docs/category_crud.png)](docs/category_crud.png)

### 2. ❓ FAQ Management (Admin Panel)

[](#2--faq-management-admin-panel)

[![FAQ CRUD](docs/faq_crud.png)](docs/faq_crud.png)

### 3. User Queries Management (Admin Panel)

[](#3-user-queries-management-admin-panel)

[![Queries CRUD](docs/user_queries.png)](docs/user_queries.png)

### 4. 🤖 Chatbot Interface

[](#4--chatbot-interface)

[![Chatbot Icon](docs/chatbot_icon.png)](docs/chatbot_icon.png)[![Show Categories](docs/show_categories.png)](docs/show_categories.png)[![Show FAQs](docs/category_faqs.png)](docs/category_faqs.png)[![Show ASK Questions](docs/ask_question.png)](docs/ask_question.png)

---

Customization
-------------

[](#customization)

### Styling

[](#styling)

Override default styles using your own CSS targeting the chatbot’s class names.

### Templates

[](#templates)

As explained above, copy templates from the bundle and place them in:

- `templates/bundles/ChatbotBundle/category/`
- `templates/bundles/ChatbotBundle/faq/`

---

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

[](#requirements)

- PHP 8.2 or higher
- Symfony 6 or higher
- Doctrine ORM
- Twig

---

Troubleshooting
---------------

[](#troubleshooting)

### Assets Not Loading

[](#assets-not-loading)

- Run `php bin/console assets:install --symlink`
- Check `public/bundles/chatbot/` exists
- Ensure proper file permissions

### Database Errors

[](#database-errors)

- Verify DB configuration
- Run: `php bin/console doctrine:schema:validate`
- Run: `php bin/console cache:clear`

### Twig Template Errors

[](#twig-template-errors)

- Check `twig.yaml` is correctly set up
- Verify `config/bundles.php` includes the bundle
- Clear the Twig cache
- `composer require twig/string-extra`

---

Contributing
------------

[](#contributing)

We welcome contributions! Feel free to open issues or submit pull requests for new features or bug fixes.

---

License
-------

[](#license)

This bundle is open-source and licensed under the MIT License.

---

Support
-------

[](#support)

If you need help or have questions, feel free to open an issue on GitHub or contact the development team.

---

**Happy chatting! 🤖**

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance55

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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 ~12 days

Total

5

Last Release

298d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01bb98d7ceec7d2acd9f5e34e23bb26e38dd0efbaabede524ead4cbeafa73b44?d=identicon)[niravpateljoin](/maintainers/niravpateljoin)

---

Top Contributors

[![niravpateljoin](https://avatars.githubusercontent.com/u/27916009?v=4)](https://github.com/niravpateljoin "niravpateljoin (10 commits)")

### Embed Badge

![Health badge](/badges/patel-chatbot-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/patel-chatbot-bundle/health.svg)](https://phpackages.com/packages/patel-chatbot-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/storefront

Storefront for Shopware

684.2M148](/packages/shopware-storefront)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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