PHPackages                             gfs/notifications - 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. gfs/notifications

ActiveLibrary

gfs/notifications
=================

Symfony GFSNotificationsBundle

v1.0.2(10y ago)25981MITPHPPHP &gt;= 5.3.9

Since Apr 21Pushed 10y ago3 watchersCompare

[ Source](https://github.com/groupfivesoftware/Notifications)[ Packagist](https://packagist.org/packages/gfs/notifications)[ Docs](https://github.com/groupfivesoftware)[ RSS](/packages/gfs-notifications/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

1. Installation
===============

[](#1-installation)

### Install via composer

[](#install-via-composer)

`composer require gfs/notifications ~v1.0`

### Add to AppKernel.php

[](#add-to-appkernelphp)

```
new GFS\NotificationBundle\NotificationBundle(),
```

2. Create Notification
======================

[](#2-create-notification)

```
use GFS\NotificationBundle\Entity\Notification as Base;
class Notifications extends Base
{
    /**
    * @var int
    *
    * @ORM\Column(name="id", type="integer")
    * @ORM\Id
    * @ORM\GeneratedValue(strategy="AUTO")
    */
    private $id;

  /**
   * @var User
   *
   * @ORM\ManyToOne(targetEntity="User",inversedBy="notifications")
   * @ORM\JoinColumn(name="user_id", onDelete="cascade")
   */
  private $user;

  /**
   * @param UserInterface $user
   *
   * @return $this
   */
  public function setUser(UserInterface $user)
  {
      $this->user = $user;

      return $this;
  }

  /**
   * @return User
   */
  public function getUser()
  {
      return $this->user;
  }

  /**
   * Get id
   *
   * @return int
   */
  public function getId()
  {
      return $this->id;
  }

  /**
   * This is important because the server will send your JSON notifications ( json_encode(your notification) ).
   * You can customize what field you want the server to send to your client.
   */
  public function jsonSerialize()
  {
      return [
          'type' => $this->getType(),
          'description' => $this->getDescription(),
          'checked' => $this->getChecked(),
          'checkedAt' => $this->getCheckedAt(),
          'createdAt' => $this->getCreateAt(),
          'url' => $this->url,
          'id' => $this->id,
          'userId' => $this->user->getUsername() //This helps the server identify if a specific user is connected and only send notifications to that user. You can use another field for common notifications, for example group notifications.
      ];
  }
}
```

Function jsonSerialize should return an array that must contain the field 'userId', the server checks all connections if they contain this value.

3. Start server
===============

[](#3-start-server)

Symfony 2 `php app/console server:notification`

Symfony 3 `php bin/console server:notification`

4. Client job
=============

[](#4-client-job)

Use any WebSocket you want or any technologies. The most important thing is the URL, it must have GET parameter `userId`. That parameter will be bind to current connection. This `userId` is used when you create a notification, the parameter `userId` comes from function `jsonSerialize`. The GET parameter `userId` should be identical with the one returned by the function jsonSerialize, so the user receives the notification.

```
var conn = new WebSocket('ws://yourip:8080?userId='+$scope.username);
conn.onopen = function(e) {
    console.log("Connection established!");
};

conn.onmessage = function(e) {
    var noitification = JSON.parse(e.data);
    // handle your notification object here
};
```

5. Create a notification
========================

[](#5-create-a-notification)

Create an entity: `Notification`. After successfully inserting it in the database, a notification will be sent to the server and the server will find the connection that matches `userId` field from `jsonSerialize`.

```
 $notification = new Notifications();
 $notification->setType('type')
     ->setDescription('Your Notification here')
     ->setUser($user)
 ;
 $this->get('doctrine.orm.default_entity_manager')->persist($notification);
 $this->get('doctrine.orm.default_entity_manager')->flush();
```

Configuration
=============

[](#configuration)

```
#config.yml
gfs_notifications:
    host: localhost # ip or DNS where server run default is localhost
    port: 8080 # port when server want run default is 8080
    notification: GFS\NotificationBundle\Notification\Notification # you can implement your own Ratchet\MessageComponentInterface
```

Default Entity field:
=====================

[](#default-entity-field)

- id
- type ( string, 255 )
- description ( text )
- created\_at ( DateTime )
- checked\_at ( DateTime, default null )
- checked ( boolean )
- user ( instance of Symfony\\Component\\Security\\Core\\User\\UserInterface )

Remeber if you want rewrite \_\_contruct don't forget to write:

`$this->created_at = new \DateTime('now')`.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

3656d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0804742473e1ef08e1d9bea870cafb62d6ce27b75c6c30829ed5db78a76de7a?d=identicon)[adrianboros](/maintainers/adrianboros)

---

Tags

user-notifications

### Embed Badge

![Health badge](/badges/gfs-notifications/health.svg)

```
[![Health](https://phpackages.com/badges/gfs-notifications/health.svg)](https://phpackages.com/packages/gfs-notifications)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[sulu/sulu

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

1.3k1.3M151](/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.3k](/packages/contao-core-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1022.4k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

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