lemonade/component-smartemailing 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lemonade/component-smartemailing

最新稳定版本:v1.3.0

Composer 安装命令:

composer require lemonade/component-smartemailing

包简介

Modern PHP client for the SmartEmailing v3 API. Includes typed models, collections, a safe HTTP wrapper, and a high-level SmartEmailingClient.

README 文档

README

License PHP Version Packagist Version

Lemonade SmartEmailing API Client is a fully typed PHP 8.1+ wrapper for the SmartEmailing v3 REST API.
It provides high-level models, formatting helpers, strict typing, and a clean architecture that transforms raw API responses into structured domain objects.

Features

  • PHP 8.1+
  • Typed data models (contacts, lists, metadata, metrics, engagement)
  • Unified formatting layer converting raw API responses into structured arrays
  • High-level client API (SmartEmailingClient)
  • Supports:
    • retrieving lists and contacts
    • validating credentials
    • adding/updating contacts
    • deleting contacts
    • listing contacts by list
  • Compatible with PHPStan (strict mode)
  • Zero external dependencies besides Guzzle

Installation

Use Composer:

composer require lemonade/component_smartemailing

Quick Start

Initialize the API client

use Lemonade\SmartEmailing\Api\SmartEmailingApi;
use Lemonade\SmartEmailing\SmartEmailingClient;

$api = new SmartEmailingApi(
    user: 'YOUR_SMARTEMAILING_LOGIN',
    token: 'YOUR_SMARTEMAILING_TOKEN'
);

$client = new SmartEmailingClient($api);

Validate Credentials

$response = $client->checkLogin();

if ($response->success) {
    echo "API login OK";
} else {
    echo "Login failed: " . $response->message;
}

Retrieve Lists

$lists = $client->getLists();

foreach ($lists as $list) {
    echo $list->getId() . " - " . $list->getName();
}

Retrieve Contacts

$contacts = $client->getContacts();

foreach ($contacts as $contact) {
    echo $contact->getEmail();
}

Add or Update Contact

$response = $client->addOrUpdate(
    email: 'john@example.com',
    listId: 2,
    fields: [
        'name' => 'John',
        'surname' => 'Doe',
        'language' => 'cs_CZ'
    ]
);

if ($response->success) {
    echo "Contact saved.";
}

Get Contacts from List

$listContacts = $client->getContactsByList(2);

foreach ($listContacts as $c) {
    echo $c->getEmail();
}

Delete Contact

$client->removeFromList(123);

License

MIT License © Lemonade Framework

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-02