supportkbz/kandmailer
最新稳定版本:v1.4.6
Composer 安装命令:
composer require supportkbz/kandmailer
包简介
Client PHP pour l'API KandMailer (emails marketing et transactionnels).
README 文档
README
Client PHP léger pour KandMailer
Installation
composer require supportkbz/kandmailer
Usage
Config
use KandMailer\MailerClient; $client = new MailerClient('your_api_key', 'https://exemple.com');
Tips
Send - Envoi de messages
Utilisez des objets Recipient pour une meilleure flexibilité et type-safety :
use KandMailer\Models\Recipient; // Envoi simple $client->template('welcome_email') ->sendTo(new Recipient( email: 'john@example.com', firstName: 'John', lastName: 'Doe', options: ['lang' => 'en', 'priority' => 'high'] )); // Envoi multiple avec des options différentes pour chaque destinataire $recipients = [ new Recipient( email: 'john@example.com', firstName: 'John', options: ['lang' => 'en', 'crm' => '111'] ), new Recipient( email: 'jane@example.com', firstName: 'Jane', options: ['lang' => 'fr', 'crm' => '222'] ), new Recipient( phone: '+33612345678', firstName: 'Bob', options: ['lang' => 'en', 'crm' => '333'] ), ]; $client->template('welcome_email') ->sendToMultiple($recipients);
Add - Approche Classique
// Set value $client->scenario('welcome_scenario'); $client->firstName('John'); $client->lastName('Doe'); $client->email('john@example.com'); $client->phone('+33612345678'); $client->accountId('12345'); // Options, remove, exists $client->options(['lang' => 'en']); $client->setRemove(['old_tag']); $client->setExists(['check_tag']); // Call $client->add(); // Chaining $client->scenario('welcome') ->firstName('John') ->lastName('Doe') ->email('john@example.com') ->phone('+33612345678') ->add();
Remove - Approche Classique
// Set scenario (required) and email $client->scenario('welcome_scenario'); $client->email('john@example.com'); $client->remove(); // Set scenario (required) and phone $client->scenario('welcome_scenario'); $client->phone('+33612345678'); $client->remove(); // Chaining $client->scenario('welcome_scenario')->email('john@example.com')->remove();
Remove - Approche Orientée Objet
// Suppression d'un contact $client->removeFrom(new Recipient( email: 'john@example.com', scenario: 'welcome_sequence' ));
Méthodes avancées
Reset - Réutiliser le client
// Envoyer à plusieurs destinataires avec la même instance $client->template('newsletter') ->email('john@example.com') ->options(['lang' => 'en']) ->sendSingle(); // Réinitialiser pour un nouvel envoi $client->reset(); $client->template('newsletter') ->email('jane@example.com') ->options(['lang' => 'fr']) ->sendSingle();
Exigences
- PHP 8.3+
- Extension
curl
Licence
MIT. Voir le fichier LICENSE.
统计信息
- 总下载量: 254
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-16