PHP code example of ceddyg / maileva-sdk-php
1. Go to this page and download the library: Download ceddyg/maileva-sdk-php 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/ */
ceddyg / maileva-sdk-php example snippets
//Retourne un objet Maileva\Client\Api\EnvoiApi
$maileva->envoi();
//Retourne un objet Maileva\Client\Api\DocumentsApi
$maileva->documents():
//Retourne un objet Maileva\Client\Api\DestinatairesApi
$maileva->destinataires();
leva = new \Maileva\Client\Maileva(
'<YOU-MAILEVA-LOGIN>',
'<YOU-MAILEVA-PASSWORD>',
'<YOU-MAILEVA-client_id>',
'<YOU-MAILEVA-client_secret>',
new GuzzleHttp\Client(),
new \Maileva\Client\Configuration()
);
//Création d'une lettre
$body = new \Maileva\Client\Model\SendingCreation(
[
"name" => "Résiliation d'un abonnement téléphonique",
"custom_id" => "order_1234",
"custom_data" => "order_1234",
"acknowledgement_of_receipt" => true,
"acknowledgement_of_receipt_scanning" => true,
"color_printing" => true,
"duplex_printing" => true,
"optional_address_sheet" => false,
"notification_email" => "[email protected] ",
"sender_address_line_1" => "Société Durand",
"sender_address_line_2" => "M. Pierre DUPONT",
"sender_address_line_3" => "Batiment B",
"sender_address_line_4" => "10 avenue Charles de Gaulle",
"sender_address_line_5" => "",
"sender_address_line_6" => "94673 Charenton-Le-Pont",
"sender_country_code" => "FR",
"archiving_duration" => 3,
"return_envelope_reference" => 123456
]
); // \Maileva\Client\Model\RecipientCreation |
try {
$result = $maileva->envoi()->sendingsPost($body);
echo '<pre>';
print_r($result);
echo '</pre>';
} catch (Exception $e) {
echo 'Exception when calling EnvoiApi->sendingsPost: ', $e->getMessage(), PHP_EOL;
}
$sending_id = $result->getId();
//Suppression d'une lettre
try {
$result = $apiInstance->sendingsSendingIdDelete($sending_id);
echo '<pre>';
print_r($result);
echo '</pre>';
} catch (Exception $e) {
echo 'Exception when calling EnvoiApi->sendingsSendingIdDelete: ', $e->getMessage(), PHP_EOL;
}
//Récupération de toutes les lettres
try {
$result = $maileva->envoi()->sendingsGet();
echo '<pre>';
print_r($result);
echo '</pre>';
} catch (Exception $e) {
echo 'Exception when calling EnvoiApi->sendingsSendingIdGet: ', $e->getMessage(), PHP_EOL;
composer