Download the PHP package gfs/notifications without Composer
On this page you can find all versions of the php package gfs/notifications. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gfs/notifications
More information about gfs/notifications
Files in gfs/notifications
Package notifications
Short Description Symfony GFSNotificationsBundle
License MIT
Homepage https://github.com/groupfivesoftware
Informations about the package notifications
1. Installation
Install via composer
composer require gfs/notifications ~v1.0
Add to AppKernel.php
2. Create Notification
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
Symfony 2 php app/console server:notification
Symfony 3 php bin/console server:notification
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.
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
.
Configuration
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')
.
All versions of notifications with dependencies
symfony/security-bundle Version ~2.3|~3.0
symfony/framework-bundle Version ~2.3|~3.0
cboden/ratchet Version 0.3.*
doctrine/orm Version *