PHPackages                             btba/chat-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. btba/chat-bundle

ActiveSymfony-bundle

btba/chat-bundle
================

Chat generator for Symfony applications

134[18 PRs](https://github.com/12rambau/Chat-bundle/pulls)CSS

Since Apr 5Pushed 3y agoCompare

[ Source](https://github.com/12rambau/Chat-bundle)[ Packagist](https://packagist.org/packages/btba/chat-bundle)[ RSS](/packages/btba-chat-bundle/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (19)Used By (0)

[![POGODEV](https://github.com/12rambau/Chat-bundle/raw/master/assets/img/github_logo.png?raw=true)](https://github.com/12rambau/Chat-bundle/blob/master/assets/img/github_logo.png?raw=true)

Welcome to the chat bundle project !
====================================

[](#welcome-to-the-chat-bundle-project-)

[![Build Status](https://camo.githubusercontent.com/440cea527013e5151cee04c66bdaacdc54f49d6ff2998ec4d5949c4d6405d062/68747470733a2f2f7472617669732d63692e6f72672f313272616d6261752f436861742d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/12rambau/Chat-bundle) [![Maintainability](https://camo.githubusercontent.com/9519c1e877a79ce0e2932d3125978fa05020ed4066448783106ec8a50d29833a/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36346662366439643563393533643432656261392f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/12rambau/Chat-bundle/maintainability) [![Test Coverage](https://camo.githubusercontent.com/8053eb8b673e84f554114dad96ebe8169a79541695e3f639e589fc79769daf24/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36346662366439643563393533643432656261392f746573745f636f766572616765)](https://codeclimate.com/github/12rambau/Chat-bundle/test_coverage) [![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://github.com/12rambau/Chat-bundle/LICENSE)

This project aim to offer a simple chat service to any symfony application.

installation
------------

[](#installation)

As this project is very new, we decided not to add a receipe on Symfony Flex at the moment so the configuration must be performed manually.

### register

[](#register)

First install the dependencies by running this comand in your repository

```
composer require btba/chat-bundle

```

and register the bundle

```
// config/bundles.php

return [
    //your bundles
    Btba\ChatBundle\BtbaChatBundle::class => ['all' => true]
];
```

### config

[](#config)

then in your app directory add a config file. The following parameters are mandatory:

```
# config/packages/btba_chat.yaml

btba_chat:
    update_interval: 1000
    message_class: App\Entity\ChatMessage
    author_class: App\Entity\User
```

> `update_interval` refers to the time between two refresh of the chat
> `message_class` refers to the ORM class that host the messages (Doctrine supported)
> `author_class` refers to the ORM class that host the auhors (Doctrine supported)

Then register the bundle routes and change the `prefix` according to your needs

```
# config/routes/btba_chat.yaml

btba_chat:
    resource: '@BtbaChatBundle/Resources/config/routes.yaml'
    prefix: /chat-bundle/
```

### database

[](#database)

In order to save authors and messages in your database you need to create at least two classes that extends the bundle model as such:

```
// App\Entity\User

/**
 * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
 */
class User extends BaseAuthor implements UserInterface
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=180, unique=true)
     */
    protected $username;

     /**
     * @ORM\OneToMany(targetEntity="App\Entity\ChatMessage", mappedBy="author", cascade={"persist"}, orphanRemoval=true)
     */
    private $messages;
```

```
// App\Entity\ChatMesssage

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Btba\ChatBundle\Model\BaseChatMessage;

/**
 * @ORM\Entity(repositoryClass="App\Repository\ChatMessageRepository")
 */
class ChatMessage extends BaseChatMessage
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=255)
     */
    protected $content;

    /**
     * @ORM\Column(type="datetime")
     */
    protected $date;

    /**
     * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="messages", cascade={"persist"})
     * @ORM\JoinColumn(nullable=false)
     */
    protected $author;

}
```

and in the `message_class` repository add the following trait:

```
// src/Repository/ChatMessageRepository.php

namespace App\Repository;

use Btba\ChatBundle\Query\MessageQuery;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;

class ChatMessageRepository extends ServiceEntityRepository
{
    use MessageQuery;

    //your code...
}
```

configuration is over you are good to go !

usage
-----

[](#usage)

To use this bundle, you need to add several component to your views.

If you're using encore, add the following assets to you're `app.css` file

```
@import '../../vendor/btba/chat-bundle/assets/css/chat.css';
```

and `app.js` file

```
import * as chat from '../../vendor/btba/chat-bundle/assets/js/chat';

//functions for the chat window management
$(function(){
    $("#chevron").click(function(e) {
        chat.changeChevron(e.target);
    });

    $("#chat-submit").click(function(e) {
        chat.submitChat(e);
    });
});
```

in your view you now just have to render the following controller:

```
{{ render(controller('Btba\\ChatBundle\\Controller\\ChatController::show')) }}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f9664a6d6f8b3d3f7d84c9f9b7df765e86796017f6a110583f1d91b0a88699fc?d=identicon)[12rambau](/maintainers/12rambau)

---

Top Contributors

[![12rambau](https://avatars.githubusercontent.com/u/12596392?v=4)](https://github.com/12rambau "12rambau (50 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")

### Embed Badge

![Health badge](/badges/btba-chat-bundle/health.svg)

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

PHPackages © 2026

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