PHP code example of panlatent / element-messages

1. Go to this page and download the library: Download panlatent/element-messages library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

panlatent / element-messages example snippets




use panlatent\elementmessages\Plugin;

$messages = Plugin::getInstance()->getMessages();

$message = $messages->createMessage([
   'senderId' => 1,
   'targetId' => 2,
   'contentId' => 3,
]);

$messages->saveMessage($message);




use panlatent\elementmessages\Plugin;

$messages = Plugin::getInstance()->getMessages();

$results = $messages->findMessages([
    'senderId' => 1
]);


$total = $messages->getTotalMessages([
    'senderId' => 1,
    'targetId' => 2,
]);