Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilien Gilet committed Oct 17, 2017
1 parent d9ccc1c commit 8eb8852
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
59 changes: 31 additions & 28 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">mgilet/notification-bundle</h1>

<p align="center">
A simple Symfony bundle to notify user
An easy yet powerful notification bundle for Symfony
<br>
<br>
<a href="https://packagist.org/packages/mgilet/notification-bundle"><img src="https://poser.pugx.org/mgilet/notification-bundle/v/stable" alt="Latest Stable Version"></a>
Expand All @@ -16,22 +16,21 @@ A simple Symfony bundle to notify user

<p align="center"><img src="http://i.imgur.com/07OcF6c.gif" alt="mgilet/notificationBundle"></p>

Create and manage user notifications in an efficient way.
Create and manage notifications in an efficient way.

Symfony support :
* 2.7.x
* 2.8.x
* 3.x

Bootstrap > 3.x highly recommended

## Features

- Easy notification management
- Simple Twig render method
- Pretty Twig template (dropdown using Bootstrap 3)
- Fully customizable
- 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.
Expand All @@ -50,40 +49,44 @@ First :
$ composer require mgilet/notification-bundle
```

See [documentation](Resources/doc/index.rst) for next steps


**See [documentation](Resources/doc/index.rst) for next steps**



### Basic usage

```php
class DefaultController extends Controller
class MyController extends Controller
{

...

/**
* @Route("/send-notification", name="send_notification")
* @param Request $request
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function sendNotification(Request $request)
{
$manager = $this->get('mgilet.notification');
$notif = $manager->generateNotification('Hello world !');
$notif
->setMessage('This a notification.')
->setLink('http://symfony.com/');
$manager->addNotification($this->getUser(), $notif);

// or the one-line method :
// $manager->createNotification($this->getUser(), 'Notification subject','Some random text','http://google.fr');

return $this->redirectToRoute('homepage');
$manager = $this->get('mgilet.notification');
$notif = $manager->createNotification('Hello world !');
$notif->setMessage('This a notification.');
$notif->setLink('http://symfony.com/');
// or the one-line method :
// $manager->createNotification('Notification subject','Some random text','http://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);

...
}
```

See [HERE](Resources/doc/usage.rst) for more

## Translations

**See [HERE](Resources/doc/usage.rst) for more**



## ****Translations

For now this bundle is only translated to de, en, es, fr, it.

Expand Down
4 changes: 2 additions & 2 deletions Resources/doc/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ Sample route:
public function sendNotification(Request $request)
{
$manager = $this->get('mgilet.notification');
// or the one-line method :
// $manager->createNotification('Notification subject','Some random text','http://google.fr');
$notif = $manager->createNotification('Hello world !');
$notif->setMessage('This a notification.');
$notif->setLink('http://symfony.com/');
// or the one-line method :
// $manager->createNotification('Notification subject','Some random text','http://google.fr');
// you can add a notification to a list of entities
// the third parameter ``$flush`` allows you to directly flush the entities
Expand Down

0 comments on commit 8eb8852

Please sign in to comment.