xlabs/inboxbundle

Inbox management bundle

Installs: 269

Dependents: 0

Suggesters: 0

Security: 0

Type:laravel-library

1.0.8 2023-12-14 09:15 UTC

This package is auto-updated.

Last update: 2024-11-14 11:26:40 UTC


README

An Inbox Manager System

Installation

Install through composer:

php -d memory_limit=-1 composer.phar require atm/inboxbundle

In your AppKernel

public function registerbundles()
{
    return [
    	...
    	...
    	new ATM\InboxBundle\ATMInboxBundle(),
    ];
}

Routing

Append to main routing file:

# app/config/routing.yml
  
atm_inbox:
    resource: "@ATMInboxBundle/Resources/config/routing.yml"
    prefix:   /

Configuration sample

Default values are shown below:

# app/config/config.yml
  
atm_inbox:
    class:
        model:
            conversation: Your conversation class namespace
            conversation_message: Your conversation message namespace
            message: Your message namespace
            user: Your User namespace

Inheritance of classes

In order to use the ATMInboxBundle classes you will have to create your own Conversation, ConversationMessage and Message classes that will extend from the ATMInboxBundle's Conversation, ConversationMessage and Message abstract classes as shown bellow:

namespace CoreBundle\Entity;

use ATM\InboxBundle\Entity\Conversation as BaseConversation;

class Conversation extends BaseConversation{}
namespace CoreBundle\Entity;

use ATM\InboxBundle\Entity\ConversationMessage as BaseConversationMessage;

class ConversationMessage extends BaseConversationMessage{}
namespace CoreBundle\Entity;

use ATM\InboxBundle\Entity\Message as BaseMessage;

class ConversationMessage extends BaseConversationMessage{}

Twig Extension

You can use the following twig extension to know how many unread message the user has:

{{ getUnreadMessages(app.user.id) }}