aurabx/harmony-dsl 问题修复 & 功能扩展

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

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

aurabx/harmony-dsl

Composer 安装命令:

composer require aurabx/harmony-dsl

包简介

TOML Schema DSL definitions for Harmony Proxy configuration files

README 文档

README

Installation

PHP (Composer)

Install via Composer:

composer require aurabx/harmony-dsl

Rust (Cargo)

Add to your Cargo.toml:

[dependencies]
harmony-dsl = "1.10"

Usage

PHP

The package provides TOML schema definitions as data files. Access them directly from your PHP application:

$configSchemaPath = __DIR__ . '/vendor/aurabx/harmony-dsl/harmony-config-schema.toml';
$pipelineSchemaPath = __DIR__ . '/vendor/aurabx/harmony-dsl/harmony-pipeline-schema.toml';

// Load and parse the schema files with your TOML parser
$configSchema = parse_toml_file($configSchemaPath);
$pipelineSchema = parse_toml_file($pipelineSchemaPath);

Rust

The schema files are embedded as string constants in the crate:

use harmony_dsl::{CONFIG_SCHEMA, PIPELINE_SCHEMA};

// Access the schema contents as &str
let config_schema = CONFIG_SCHEMA;
let pipeline_schema = PIPELINE_SCHEMA;

// Parse with your TOML parser
let config: toml::Value = toml::from_str(config_schema)?;
let pipeline: toml::Value = toml::from_str(pipeline_schema)?;

Quick Start

This directory contains the TOML Schema DSL definitions for Harmony Proxy configuration files. These schemas enable cross-language validation between Rust (harmony-proxy) and PHP (Runbeam Cloud API).

Files

File Purpose
dsl.md DSL specification and field reference
harmony-config-schema.toml Schema for main config files (config.toml)
harmony-pipeline-schema.toml Schema for pipeline files (pipelines/*.toml)
harmony-remote-ingress-schema.toml Schema for remote ingress catalogues shared between gateways
harmony-schema-guide.md Implementation guide and API design implications

What is the Schema DSL?

The Schema DSL is a declarative language written in TOML that describes:

  • Configuration file structure (tables, fields, types)
  • Validation rules (required fields, enums, ranges)
  • Default values and conditional requirements
  • Documentation (descriptions for every element)

Why Use a DSL?

  1. Single Source of Truth - One schema definition used by both Rust and PHP
  2. Automatic Validation - Catch config errors before deployment
  3. API Contract - Defines what the Runbeam Cloud API needs to store/serve
  4. Code Generation - Generate structs, DTOs, and templates from schemas
  5. Documentation - Schema includes human-readable descriptions

Key Concepts

Config Hierarchy

Harmony uses a two-level configuration system:

config.toml              ← Main gateway config
├── [proxy]             ← Core settings (ID, logging, paths)
├── [network.*]         ← Network definitions (HTTP listeners, WireGuard)
├── [management]        ← Management API config
├── [storage]           ← Storage backend (filesystem, S3)
└── [services.*]        ← Service type registry

pipelines/*.toml         ← Pipeline configs (loaded from config.pipelines_path)
├── [pipelines.*]       ← Pipeline routing definitions
├── [endpoints.*]       ← Endpoint configs (how requests arrive)
├── [backends.*]        ← Backend configs (where requests go)
└── [middleware.*]      ← Middleware instances (transform, auth, etc.)

Pattern Matching

Tables with wildcard names match multiple instances:

# Schema: network.*
# Matches: [network.default], [network.management], [network.vpn]

This is crucial for dynamic configurations where users can define multiple networks, pipelines, endpoints, etc.

How This Guides API Design

Data Model

The schemas define what the Runbeam Cloud API needs to store in the database:

gateways
├── id
├── code
├── config_toml          ← Validated against harmony-config-schema.toml
└── pipelines
    ├── name
    └── config_toml      ← Validated against harmony-pipeline-schema.toml

Example Schema Definition

[[table]]
name = "proxy"
required = true
description = "Core proxy configuration"

[[table.field]]
name = "id"
type = "string"
required = true
description = "Unique gateway identifier"

[[table.field]]
name = "log_level"
type = "string"
required = false
default = "error"
enum = ["trace", "debug", "info", "warn", "error"]
description = "Logging verbosity"

This defines:

  • A required [proxy] table
  • A required id field (string)
  • An optional log_level field (string, defaults to "error", must be one of 5 values)

aurabx/harmony-dsl 适用场景与选型建议

aurabx/harmony-dsl 是一款 基于 Rust 开发的 Composer 扩展包,目前已累计 39 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 aurabx/harmony-dsl 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-06