Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/panlatent/element-messages
Element Messages for CraftCMS
https://github.com/panlatent/element-messages
craftcms craftcms-plugin element message
Last synced: about 1 month ago
JSON representation
Element Messages for CraftCMS
- Host: GitHub
- URL: https://github.com/panlatent/element-messages
- Owner: panlatent
- License: mit
- Created: 2019-02-24T02:31:54.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-10T16:31:06.000Z (9 months ago)
- Last Synced: 2024-07-12T07:44:24.605Z (5 months ago)
- Topics: craftcms, craftcms-plugin, element, message
- Language: PHP
- Homepage:
- Size: 39.1 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Element Messages
================
[![Build Status](https://travis-ci.org/panlatent/element-messages.svg)](https://travis-ci.org/panlatent/element-messages)
[![Coverage Status](https://coveralls.io/repos/github/panlatent/element-messages/badge.svg?branch=master)](https://coveralls.io/github/panlatent/element-messages?branch=master)
[![Latest Stable Version](https://poser.pugx.org/panlatent/element-messages/v/stable.svg)](https://packagist.org/packages/panlatent/element-messages)
[![Total Downloads](https://poser.pugx.org/panlatent/element-messages/downloads.svg)](https://packagist.org/packages/panlatent/element-messages)
[![Latest Unstable Version](https://poser.pugx.org/panlatent/element-messages/v/unstable.svg)](https://packagist.org/packages/panlatent/element-messages)
[![License](https://poser.pugx.org/panlatent/element-messages/license.svg)](https://packagist.org/packages/panlatent/element-messages)
[![Craft CMS](https://img.shields.io/badge/Powered_by-Craft_CMS-orange.svg?style=flat)](https://craftcms.com/)
[![Yii2](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)Element messages help your Craft application create messages between two elements and use any one element as the message
content. It makes it easy to build relationships between three elements and provides a powerful way to query.We can
customize the types of rich and flexible messages by sender element type, target element type and content element type.
This relationship is stored in another database table, which helps reduce the data size of the Craft element
relationship table. This should be a better solution for sending the same content multiple times (e.g. group sending).Requirements
------------This plugin requires Craft CMS 3.1 or later.
Installation
------------To install the plugin, follow these instructions.
1. Open your terminal and go to your Craft project:
cd /path/to/project
2. Then tell Composer to load the plugin:
composer require panlatent/element-messages
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Element Messages.
Usages
------### Create a message
```php
getMessages();$message = $messages->createMessage([
'senderId' => 1,
'targetId' => 2,
'contentId' => 3,
]);$messages->saveMessage($message);
```
### Messages Query
```php
getMessages();$results = $messages->findMessages([
'senderId' => 1
]);$total = $messages->getTotalMessages([
'senderId' => 1,
'targetId' => 2,
]);```
For more query conditions, please refer to [`panlatent\elementmessages\models\MessageCriteria`](src/models/MessageCriteria.php).
Documentation
-------------+ Read the Documentation: [English](https://element-messages.docs.panlatent.com/).
License
-------
The Element Messages is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).