{"id":14966680,"url":"https://github.com/thyseus/yii2-message","last_synced_at":"2025-10-25T17:30:30.653Z","repository":{"id":141909647,"uuid":"72215018","full_name":"thyseus/yii2-message","owner":"thyseus","description":"System for users to send each other private messages.","archived":false,"fork":false,"pushed_at":"2018-06-06T08:17:21.000Z","size":139,"stargazers_count":38,"open_issues_count":4,"forks_count":17,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-01-31T09:22:59.705Z","etag":null,"topics":["ignorelist","message","messages","yii2-extension","yii2-framework","yii2-message"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thyseus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-28T14:35:56.000Z","updated_at":"2024-11-11T01:55:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"2bb83750-5b87-4918-b145-2445a0c05ad4","html_url":"https://github.com/thyseus/yii2-message","commit_stats":{"total_commits":119,"total_committers":7,"mean_commits":17.0,"dds":0.07563025210084029,"last_synced_commit":"8cae3c6f11c8cebfd06a02b67208e6b889c6b361"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyseus%2Fyii2-message","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyseus%2Fyii2-message/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyseus%2Fyii2-message/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyseus%2Fyii2-message/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thyseus","download_url":"https://codeload.github.com/thyseus/yii2-message/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238183617,"owners_count":19430156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ignorelist","message","messages","yii2-extension","yii2-framework","yii2-message"],"created_at":"2024-09-24T13:36:47.637Z","updated_at":"2025-10-25T17:30:30.304Z","avatar_url":"https://github.com/thyseus.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ATTENTION:\n\ngithub has been bought by Microsoft. This repository is orphaned and has been moved to:\n\nhttps://gitlab.com/thyseus/yii2-message\n\nThanks a lot for your understanding and blame Microsoft.\n\n# Yii2-message\n\nSystem for users to send each other private messages.\n- A user configurable ignorelist and admin configurable whitelist (administrators are able to fine-tune \nthe definition of which users are able to write to whom) is supported.\n- Encryption is not (yet?) supported.\n- Uses Font Awesome (http://fontawesome.io/) for some icons\n- Every message sent inside the messaging system can be forwarded to the recipient be e-mail automatically.\n- Since 0.4.0 you can save drafts and use signatures\n\n## Prerequisites:\n\nYou need a Model with the 'id' and 'username' attributes. This needs to be an ActiveRecord or Model instance.\n\nI suggest to use https://github.com/dektrium/yii2-user which works wonderful with this module.\nNote that dektrium is no longer maintained, for future projects you should take a look at:\nhttps://github.com/2amigos/yii2-usuario\n\n## Installation\n\n```bash\n$ composer require thyseus/yii2-message\n$ php yii migrate/up --migrationPath=@vendor/thyseus/yii2-message/migrations\n```\n\n## Configuration\n\nAdd following lines to your main configuration file:\n\n```php\n'modules' =\u003e [\n    'message' =\u003e [\n        'class' =\u003e 'thyseus\\message\\Module',\n        'userModelClass' =\u003e '\\app\\models\\User', // your User model. Needs to be ActiveRecord.\n    ],\n],\n```\n\n## Sending E-Mails\n\nIf you want the system to automatically send E-Mails via Yii::$app-\u003emailer you only need to provide an\n'email' column in your ActiveRecord Model.\n\nUse the $mailMessages module option to define which users are getting E-Mails. For Example:\n\n```php\n        'mailMessages' =\u003e function ($user) {\n            return $user-\u003eprofile-\u003ereceive_emails === true;\n        },\n```\n\nYou can overwrite the default e-mail views and layout by providing an @app/mail/ directory inside your Application.\n\n## Mailqueue\n\nFrom version 0.4 and above you can use yii2-queue (https://github.com/yiisoft/yii2-queue) to send messages via a\nmail queue. Once you have yii2-queue configured in your application you can set\n\n```php\n        'useMailQueue' =\u003e true,\n```\n\nto let yii2-message push an EmailJob on to your queue instead of sending the E-Mail directly.\n\nIf you want to use an mailqueue like https://github.com/nterms/yii2-mailqueue you can override the 'mailer' \nconfiguration option in the module configuration. Since yii2-queue is stable and an official extension i personally\nprefer to use yii2-queue instead of 3rd party extensions.\n\n## Ignore List and Recipients Filter\n\nThe user can manage his own ignore list using the message/message/ignorelist route. You can place a callback that\ndefines which users should be able to be messaged. For example, if you do not want your users to be able to write\nto admin users, do this:\n\n```php\n        'recipientsFilterCallback' =\u003e function ($users) {\n            return array_filter($users, function ($user) {\n                return !$user-\u003eisAdmin;\n            });\n        },\n```\n\nThe recipients filter is applied after the ignore list.\n\n## Actions\n\nThe following Actions are possible:\n\n* inbox: https://your-domain/message/message/inbox\n* drafts: https://your-domain/message/message/drafts\n* signature: https://your-domain/message/message/signature\n* out-of-office: https://your-domain/message/message/out-of-office\n* sent messages: https://your-domain/message/message/sent\n* compose a message: https://your-domain/message/message/compose\n* delete a message: https://your-domain/message/message/delete/hash/\u003chash\u003e\n* view a message: https://your-domain/message/message/view/hash/\u003chash\u003e\n* manage your ignorelist: https://your-domain/message/message/ignorelist\n\nYou can place this code snippet in your layouts/main.php to give your users access\nto the message actions:\n\n```php\n$messagelabel = '\u003cspan class=\"fas fa-envelope\"\u003e\u003c/span\u003e';\n$unread = Message::find()-\u003ewhere(['to' =\u003e $user-\u003eid, 'status' =\u003e 0])-\u003ecount();\nif ($unread \u003e 0)\n      $messagelabel .= '(' . $unread . ')';\n      \necho Nav::widget([\n    'encodeLabels' =\u003e false, // important to display HTML-code (fontawesome icons)\n    'items' =\u003e [\n    // ...\n    [\n      'label' =\u003e $messagelabel,\n      'url' =\u003e '',\n      'visible' =\u003e !Yii::$app-\u003euser-\u003eisGuest, 'items' =\u003e [\n        ['label' =\u003e '\u003ci class=\"fas fa-inbox\"\u003e\u003c/i\u003e Inbox', 'url' =\u003e ['/message/message/inbox']],\n        ['label' =\u003e '\u003ci class=\"fas fa-share-square\"\u003e\u003c/i\u003e Sent', 'url' =\u003e ['/message/message/sent']],\n        '\u003chr\u003e',\n        ['label' =\u003e '\u003ci class=\"fas fa-firstdraft\"\u003e\u003c/i\u003e Drafts', 'url' =\u003e ['/message/message/drafts']],\n        ['label' =\u003e '\u003ci class=\"fas fa-clone\"\u003e\u003c/i\u003e Signature', 'url' =\u003e ['/message/message/signature']],\n        ['label' =\u003e '\u003ci class=\"fas fa-calendar-times\"\u003e\u003c/i\u003e Out of Office', 'url' =\u003e ['/message/message/out-of-office']],\n        ['label' =\u003e '\u003ci class=\"fas fa-ban\"\u003e\u003c/i\u003e Manage your Ignorelist', 'url' =\u003e ['/message/message/ignorelist']],\n        '\u003chr\u003e',\n        ['label' =\u003e '\u003ci class=\"fas fa-plus\"\u003e\u003c/i\u003e Compose a Message', 'url' =\u003e ['/message/message/compose']],\n      ]\n    ],\n    // ...\n  ]);\n```\n\nSince 0.3.0 you can render the compose view inside an Modal Widget like this:\n\n```php\nuse kartik\\growl\\GrowlAsset;\nuse yii\\bootstrap\\Modal;\nuse yii\\helpers\\Url;\n\nGrowlAsset::register($this);\n\nModal::begin(['id' =\u003e 'compose-message', 'header' =\u003e '\u003ch2\u003eCompose new Message\u003c/h2\u003e']);\nModal::end();\n\n$recipient_id = 1337; # write an message to user with id 1337\n\necho Html::a('\u003cspan class=\"fas fa-envelope\"\u003e\u003c/span\u003e Compose Message', '', [\n  'class' =\u003e 'btn btn-default btn-contact-user',\n  'data-recipient' =\u003e $recipient_id,\n  'data-pjax' =\u003e 0\n]);\n\n$message_url = Url::to(['//message/message/compose']);\n\n$this-\u003eregisterJs(\"\n  $('.modal-body').on('click', '.btn-send-message', function(event) {\n       if ($('#message-title').val()) {\n           $.post('\".$message_url.\"', $('#message-form').serializeArray(), function() {\n               $.notify({message: 'Message has been sent successfully.'}, {type: 'success'});\n               $('#compose-message').modal('hide');\n           });\n      } else {\n          $('.modal-body').prepend('\u003cdiv class=\\\"alert alert-warning\\\"\u003ePlease enter a title at least.\u003c/div\u003e');\n      }\n\n     event.preventDefault();\n  });\n  \n  $('.modal-body').on('submit', '#message-form', function(event) {\n    $('.btn-send-message').click(); \n    event.preventDefault();\n  });\n   \n\n  $('body').on('click', '.btn-contact-user', function(event) {\n    $('#compose-message').modal();\n    recipient = $(this).data('recipient');\n    $.ajax('\".$message_url.\"?to='+recipient+'\u0026add_to_recipient_list=1', {\n      'success': function(result) {\n           $('.modal-body').html(result);\n       }\n    });\n\n    event.preventDefault();\n    });\n\");\n```\n\nFor some common url rules, you can copy Module::$urlRules into your 'rules' section of the URL Manager.\n\n## Contributing to this project\n\nAnyone and everyone is welcome to contribute.\n\n## License\n\nYii2-message is released under the GPLv3 License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthyseus%2Fyii2-message","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthyseus%2Fyii2-message","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthyseus%2Fyii2-message/lists"}