xlabs / inboxbundle
邮箱管理组件
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
邮箱管理系统
安装
通过composer安装
php -d memory_limit=-1 composer.phar require atm/inboxbundle
在AppKernel中
public function registerbundles()
{
return [
...
...
new ATM\InboxBundle\ATMInboxBundle(),
];
}
路由
追加到主路由文件
# app/config/routing.yml
atm_inbox:
resource: "@ATMInboxBundle/Resources/config/routing.yml"
prefix: /
配置示例
以下显示默认值
# 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
类继承
为了使用ATMInboxBundle的类,您必须创建自己的Conversation,ConversationMessage和Message类,这些类将扩展ATMInboxBundle的Conversation,ConversationMessage和Message抽象类,如下所示
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扩展
您可以使用以下twig扩展来了解用户有多少未读消息
{{ getUnreadMessages(app.user.id) }}