承接 rlnks/php-mail-tree-builder 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

rlnks/php-mail-tree-builder

Composer 安装命令:

composer require rlnks/php-mail-tree-builder

包简介

Framework-agnostic PSR-7/PSR-15 API handler for the php-mail-tree visual builder

README 文档

README

Framework-agnostic PSR-7/PSR-15 API handler for the php-mail-tree visual builder.

Installation

composer require rlnks/php-mail-tree-builder

Requires PHP 8.2+ and a PSR-7/PSR-17 implementation (e.g. nyholm/psr7).

Endpoints

Method Path Description
POST {prefix}/render/node Render a single node → HTML snippet
POST {prefix}/render/document Render the full email → complete HTML
GET {prefix}/document List saved documents
POST {prefix}/document Create a new document
GET {prefix}/document/{id} Load a document
PUT {prefix}/document/{id} Save / update a document
DELETE {prefix}/document/{id} Delete a document

Quick start

use Nyholm\Psr7\Factory\Psr17Factory;
use Rlnks\MailTreeBuilder\BuilderConfig;
use Rlnks\MailTreeBuilder\BuilderHandler;

$factory = new Psr17Factory();

$handler = new BuilderHandler(
    config: new BuilderConfig(
        pathPrefix:  '/builder',
        corsOrigins: ['http://localhost:3000'],
        storage:     new MyStorage(),   // implements StorageInterface
    ),
    responseFactory: $factory,
);

// Slim 4
$app->any('/builder/{path:.*}', $handler);

// Vanilla PHP
$request  = $factory->createServerRequest($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);
$response = $handler->handle($request);
http_response_code($response->getStatusCode());
foreach ($response->getHeaders() as $name => $values) {
    header($name . ': ' . implode(', ', $values));
}
echo $response->getBody();

POST /render/node

Render a single node from a JSON tree node + StyleSheet config. The builder calls this whenever a node is added or modified, caching the HTML for canvas assembly.

{
  "sheet": {
    "primaryColor": "#003366",
    "fontFamily": "Poppins, Arial, sans-serif",
    "containerWidth": 600,
    "webFonts": [{ "url": "https://fonts.googleapis.com/…", "name": "Poppins" }],
    "styles": {
      "hero": { "container": { "background-color": "#003366" } }
    }
  },
  "node": {
    "type": "Container",
    "_tag": "Section",
    "style": { "container": { "background-color": "#ffffff" } },
    "hidden": false,
    "children": { "body": { "type": "Column", "children": {} } }
  }
}

Response: { "html": "<table>…</table>" }

POST /render/document

Render the full email. Used for the Preview button. Returns the complete <!DOCTYPE html> string.

{
  "sheet": { "…": "" },
  "tree": { "type": "EmailDocument", "…": "" },
  "locale": "fr",
  "translations": {
    "hero_title": { "fr": "Bienvenue!", "en": "Welcome!" }
  }
}

Response: { "html": "<!DOCTYPE html>…" }

Storage

Implement StorageInterface to persist documents in your preferred backend:

use Rlnks\MailTreeBuilder\StorageInterface;

class DatabaseStorage implements StorageInterface
{
    public function save(?string $id, array $document): string
    {
        $id ??= uniqid('doc_', true);
        DB::table('builder_documents')->upsert(['id' => $id, 'data' => json_encode($document)], ['id']);
        return $id;
    }

    public function load(string $id): array
    {
        $row = DB::table('builder_documents')->find($id)
            ?? throw new \RuntimeException("Document {$id} not found.");
        return json_decode($row->data, true);
    }

    public function delete(string $id): void
    {
        DB::table('builder_documents')->delete($id);
    }

    public function list(): array
    {
        return DB::table('builder_documents')
            ->select('id', 'updated_at')
            ->orderByDesc('updated_at')
            ->get()
            ->toArray();
    }
}

License

MIT

rlnks/php-mail-tree-builder 适用场景与选型建议

rlnks/php-mail-tree-builder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 rlnks/php-mail-tree-builder 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-14