Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maximiliengilet/notification-bundle
A simple Symfony bundle to notify user
https://github.com/maximiliengilet/notification-bundle
bundle php symfony symfony-bundle
Last synced: about 17 hours ago
JSON representation
A simple Symfony bundle to notify user
- Host: GitHub
- URL: https://github.com/maximiliengilet/notification-bundle
- Owner: maximilienGilet
- License: mit
- Created: 2016-05-21T11:58:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-27T18:35:19.000Z (about 2 years ago)
- Last Synced: 2024-11-15T22:12:10.754Z (about 2 months ago)
- Topics: bundle, php, symfony, symfony-bundle
- Language: PHP
- Homepage: https://packagist.org/packages/mgilet/notification-bundle
- Size: 315 KB
- Stars: 107
- Watchers: 10
- Forks: 58
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mgilet/notification-bundle
An easy yet powerful notification bundle for Symfony
Create and manage notifications in an efficient way.
Symfony support :
* 2.7.x (bundle version 2.x)
* 2.8.x (bundle version 2.x)
* 3.x
* 4.x## NOW SUPPORTS SYMFONY FLEX !
Version 3.0 out now.
## Features
- Easy setup
- Easy to use
- Powerful notification management
- Simple Twig render methods
- Fully customizable
- Multiple notifiables entities
- No bloated dependencies (little requirements)Notice: Only Doctrine ORM is supported for now.
## Upgrade from 3.x
### Custom Notification entity usage
If you use a custom Notification entitiy you must remove the `resolve_target_entities` directive from the doctrine configuration and add a configuration file.
### Example
After adding the customized notification class as in #39 just add a configuration file
`config/packages/mgilet_notification.yaml`
```yaml
mgilet_notification:
notification_class: App\Entity\MyCustomNotification
```## Installation & usage
This bundle is available on [packagist](https://packagist.org/packages/mgilet/notification-bundle).
Add notification-bundle to your project :
```bash
$ composer require mgilet/notification-bundle
```**See [documentation](Resources/doc/index.rst) for next steps**
### Basic usage
```php
class MyController extends Controller
{...
public function sendNotification(Request $request)
{
$manager = $this->get('mgilet.notification');
$notif = $manager->createNotification('Hello world!');
$notif->setMessage('This a notification.');
$notif->setLink('https://symfony.com/');
// or the one-line method :
// $manager->createNotification('Notification subject', 'Some random text', 'https://google.fr/');// you can add a notification to a list of entities
// the third parameter `$flush` allows you to directly flush the entities
$manager->addNotification(array($this->getUser()), $notif, true);...
}
```## Translations
For now this bundle is only translated to de, en, es, fa, fr, it, nl, pt_BR, pl.
Help me improve this by submitting your translations.
## Community
You can help make this bundle better by contributing (every pull request will be considered) or submitting an issue.
Enjoy and share if you like it.
## Licence
MIT