PHP code example of universityofhelsinki / mece

1. Go to this page and download the library: Download universityofhelsinki/mece 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/ */

    

universityofhelsinki / mece example snippets


use UniversityofHelsinki\MECE\NotificationMessage;
use UniversityofHelsinki\MECE\MultilingualStringValue;
use GuzzleHttp\Client;

$recipients = ['matti', 'liisa'];
$source = 'serviceXY';
$message = new NotificationMessage($recipients, $source);

// Set heading for all three default languages
$heading = new MultilingualStringValue();
$heading->setValue('Viesti', 'fi');
$heading->setValue('Message', 'en');
$heading->setValue('Meddelande', 'sv');
$message->setHeading($heading);

$client = new Client();
$host = 'https://www.example.com';
$response = $client->request('POST', $host, ['body' => $message->export()]);
if ($response->getStatusCode() == 200) {
  echo 'Done!';
}
bash
curl -sS https://getcomposer.org/installer | php
bash
php composer.phar