nanson/yii2-messenger

Private messages module for yii2

Installs: 261

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 4

Forks: 3

Open Issues: 0

Type:yii2-extension

1.0.2 2017-07-24 17:10 UTC

This package is not auto-updated.

Last update: 2024-12-21 19:33:21 UTC


README

Private messages module for yii2

Installing

The preferred way to install this extension is through Composer.

{
  "require": {
    "nanson/yii2-messenger": "*"
  }
}

Migration

./yii migrate --migrationPath=@vendor/nanson/yii2-messenger/migrations/

Configure module:

    'modules' => [
        'messenger' => [
            'class' => \nanson\messenger\Messenger::className(),
        ],
    ],

Usage

Url for contacts list: /messenger/contacts/.

Contacts

Url for messages list: /messenger/contacts/messages/?id={contact_id}

Messages

Contacts widget

Display contacts list for user with last message.

<?php
echo \nanson\messenger\widgets\Contacts::widget();
?>

Messages widget

Display user messages with current contact

<?php
echo \nanson\messenger\widgets\Messages::widget([
    'contactId' => $contactId,
]);
?>

Add message widget

Display form to message creation.

<?php
echo \nanson\messenger\widgets\AddMessage::widget([
	'contactId' => $contactId,
	'pjaxId' => "pjaxMessages",
]);
?>

Messages counter widget

Display count unreaded messages for user.

<?php
echo \nanson\messenger\widgets\Counter::widget();
?>