akramzerarka / maileva-sdk-php
v2.0.9
2023-04-28 13:31 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2|^7.0
Requires (Dev)
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
README
API用于发送和跟踪由邮递员分发的在线推荐信。它包括创建发送、添加文档和收件人、选择选项(黑白或彩色、单面或双面、带或不带AR等)的关键功能。
- 创建发送,
- 添加文档和收件人,
- 选择选项(黑白或彩色、单面或双面、带或不带AR等)。
- 跟踪生产(计划日期、发送跟踪等)。请参阅“notification_center”文档。
需求
PHP 5.5及更高版本
安装和用法
Composer
要使用Composer安装绑定,请将以下内容添加到composer.json
composer require akramzerarka/maileva-sdk-php
测试
要运行单元测试,
composer install
./vendor/bin/phpunit
入门指南
请遵循安装过程,然后运行以下命令
Maileva\Client\Maileva类有3个函数
//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();
然后只需使用每个对象的端点。
<?php require_once(__DIR__ . '/vendor/autoload.php'); $maileva = 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" => "do_not_reply@maileva.com", "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;
API端点文档
所有URI都相对于https://api.sandbox.maileva.net/registered_mail/v2
模型文档
- 正文
- 国家代码
- 递送状态响应
- 递送状态响应递送状态
- 文档响应
- 文档响应
- 信封类型
- 错误响应
- 错误响应
- 导入收件人
- 页面范围
- 分页响应
- 优先级
- 收件人创建
- 收件人响应
- 收件人状态
- 收件人计数
- 收件人响应
- 发送创建
- 发送响应
- 发送状态
- 发送响应
- 发送的发送ID文档元数据
授权文档
bearerAuth
- 类型:HTTP承载认证