xlabs / inboxbundle
Inbox management bundle
1.0.8
2023-12-14 09:15 UTC
Requires
- php: >=5.3.9
- composer/installers: ~1.0
- xlabs/trumbowygbundle: ~1.0
Requires (Dev)
Suggests
- symfony/asset: For using the AssetExtension
- symfony/expression-language: For using the ExpressionExtension
- symfony/finder: For using the finder
- symfony/form: For using the FormExtension
- symfony/http-kernel: For using the HttpKernelExtension
- symfony/routing: For using the RoutingExtension
- symfony/security: For using the SecurityExtension
- symfony/stopwatch: For using the StopwatchExtension
- symfony/templating: For using the TwigEngine
- symfony/translation: For using the TranslationExtension
- symfony/var-dumper: For using the DumpExtension
- symfony/yaml: For using the YamlExtension
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) }}