2017 © Pedro Peláez
 

yii2-extension yii2-messenger

Private messages module for yii2

image

nanson/yii2-messenger

Private messages module for yii2

  • Monday, July 24, 2017
  • by nanson
  • Repository
  • 4 Watchers
  • 5 Stars
  • 109 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 7 % Grown

The README.md

Yii2 Messenger

Private messages module for yii2, (*1)

Installing

The preferred way to install this extension is through Composer., (*2)

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

Migration, (*3)

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

Configure module:, (*4)

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

Usage

Url for contacts list: /messenger/contacts/., (*5)

Contacts, (*6)

Url for messages list: /messenger/contacts/messages/?id={contact_id}, (*7)

Messages, (*8)

Contacts widget

Display contacts list for user with last message., (*9)

<?php
echo \nanson\messenger\widgets\Contacts::widget();
?>
Option Type Description
userId integer User ID. Default: \Yii::$app->user->id
tpl string Widget template. Default: create
options array The HTML attributes for the widget wrapper tag. Default: []
pageSize integer Contacts per page. Default: 10
defaultOrder array Default contacts order Default: ['last_message_id' => SORT_DESC]
viewRoute string Route to messages. Default: /messenger/contacts/messages
dataProviderOptions array Options for yii\data\ActiveDataProvider. Default: []
queryModifier callable Function to modify ActiveDataProvider query. Default: null
skinAsset string Skin Asset Bundles class. Default: null

Messages widget

Display user messages with current contact, (*10)

<?php
echo \nanson\messenger\widgets\Messages::widget([
    'contactId' => $contactId,
]);
?>
Option Type Description
contactId integer Contact ID.
userId integer User ID. Default: \Yii::$app->user->id
tpl string Widget template. Default: messages
options array The HTML attributes for the widget wrapper tag. Default: []
pageSize integer Messages per page. Default: 10
defaultOrder array Default contacts order Default: ['created_at' => SORT_DESC]
dataProviderOptions array Options for yii\data\ActiveDataProvider. Default: []
queryModifier callable Function to modify ActiveDataProvider query. Default: null
skinAsset string Skin Asset Bundles class. Default: null

Add message widget

Display form to message creation., (*11)

<?php
echo \nanson\messenger\widgets\AddMessage::widget([
    'contactId' => $contactId,
    'pjaxId' => "pjaxMessages",
]);
?>
Option Type Description
contactId integer Contact ID.
userId integer User ID. Default: \Yii::$app->user->id
tpl string Widget template. Default: create
options array The HTML attributes for the widget wrapper tag. Default: []
formOptions array The HTML attributes for the widget form. Default: []
route string Route to create message action. Default: /messenger/rest/create
skinAsset string Skin Asset Bundles class. Default: null
pjaxId string Pjax widget Id. If specified, pjax will be reloaded after message creation. Default: null
fancySelector string Fancybox selector. If specified, widget will be rendered as Fancybox. https://github.com/newerton/yii2-fancybox Default: null
fancyOptions array Fancybox widget options. Default: null

Messages counter widget

Display count unreaded messages for user., (*12)

<?php
echo \nanson\messenger\widgets\Counter::widget();
?>
Option Type Description
route string Route to action. Default: /messenger/rest/count
timeout integer Update timout. Default: 30
tag string Counter html tag. Default: span
options array The HTML attributes for the counter tag. Default: ['class' => 'badge']

The Versions

24/07 2017

dev-master

9999999-dev

Private messages module for yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Denis Chernyavsky

extension yii2 module yii messages message messenger private-messages

24/07 2017

1.0.2

1.0.2.0

Private messages module for yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Denis Chernyavsky

extension yii2 module yii messages message messenger private-messages

16/07 2016

1.0.1

1.0.1.0

Private messages module for yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Denis Chernyavsky

extension yii2 module yii messages message messenger private-messages

19/12 2015

1.0.0

1.0.0.0

Private messages module for yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Denis Chernyavsky

extension yii2 module yii messages message messenger private-messages