定制 statikbe/craft-flexmail 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

statikbe/craft-flexmail

Composer 安装命令:

composer require statikbe/craft-flexmail

包简介

Flexmail integration for Craft CMS

README 文档

README

This plugin integrates the Flexmail REST API into Craft CMS. The first version will focus on adding contacts, and assigning preferences & interests.

Requirements

  • Craft CMS 5.0.0 or later

Installation

To install the plugin, follow these instructions:

cd /path/to/project
composer require statikbe/craft-flexmail
./craft  plugin/install flexmail

Settings

The plugin has the following settings:

  • API username (apiUsername)
  • API token (apiToken)
  • Default contact source (defaultSource) (read more about Flexmail sources here)

The default contact source can be set in settings, or you can set in template using a hidden source field.

Usage

By default, a contact in Flexmail has the following fields (API docs):

  • Email (required)
  • First name
  • Last name
  • Language (required)

Basic subscribe form

 <form method="post">
    {{ actionInput('flexmail/contacts/add') }}
    {{ csrfInput() }}
    <div>
        <label for="email">E-mail</label>
        <input type="email" name="email" id="email">
    </div>
    <div>
        <label for="firstName">First name</label>
        <input type="text" name="firstName" id="firstName">
    </div>
    <div>
        <label for="lastName">Last name</label>
        <input type="text" name="lastName" id="lastName">
    </div>
    <input type="submit" value="Subscribe">
</form>

Subscribe form with custom fields

Flexmail custom fields can be added in the fields namespace. For example fields[city], where "city" is the handle of the custom field in Flexmail.

 <form method="post">
    {{ actionInput('flexmail/contacts/add') }}
    {{ csrfInput() }}
    <div>
        <label for="email">E-mail</label>
        <input type="email" name="email" id="email">
    </div>

    <div>
        <label for="custom">Your organisation</label>
        <input type="text" name="fields[organisation]" id="custom">
    </div>
    <input type="submit" value="Subscribe">
</form>

Subscribe form with interests

To segment or add metadata to contacts in Flexmail use interests[].

It's important to note that the values for these need to be the ID of that item in Flexmail.

Note: The older labels[] and preferences[] fields are deprecated as of v3.0.0 and should not be used. Please use interests[] instead.

 <form method="post">
        {{ actionInput('flexmail/contacts/add') }}
        {{ csrfInput() }}
        <div>
            <label for="email">E-mail</label>
            <input type="email" name="email" id="email">
        </div>

        // Interests
        <input type="checkbox" name="interests[]" value="interestId">

        <input type="submit" value="Subscribe">
    </form>

Interests can be imported and refresh from the API through a Utility.

Fields

The plugin includes fields for interests that are defined in your Flexmail account.

The idea here is that you can create an interest for contacts that subscribe from a specific page/product/etc.

This field will use the imported interests.

Helpers

Flexmail uses ID's for most things (sources, labels, preferences) but those ID's are not exposed in the webpages.

You can use these console command to list each of these, they will return all items with their ID and label

flexmail/debug/get-interest
flexmail/debug/get-sources

statikbe/craft-flexmail 适用场景与选型建议

statikbe/craft-flexmail 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 219 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cms」 「Craft」 「craftcms」 「flexmail」 「craft-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 statikbe/craft-flexmail 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 statikbe/craft-flexmail 我们能提供哪些服务?
定制开发 / 二次开发

基于 statikbe/craft-flexmail 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-24