惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
Scott Helme
Scott Helme
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Stack Overflow Blog
Stack Overflow Blog
Forbes - Security
Forbes - Security
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
S
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
N
News | PayPal Newsroom
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Project Zero
Project Zero
Cyberwarzone
Cyberwarzone
Vercel News
Vercel News
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Google Online Security Blog
Google Online Security Blog
Simon Willison's Weblog
Simon Willison's Weblog
MongoDB | Blog
MongoDB | Blog
Martin Fowler
Martin Fowler
T
Tenable Blog
I
InfoQ
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
G
Google Developers Blog
D
DataBreaches.Net
博客园 - Franky
Know Your Adversary
Know Your Adversary
Spread Privacy
Spread Privacy
S
Security @ Cisco Blogs
Hacker News: Ask HN
Hacker News: Ask HN
J
Java Code Geeks
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Full Disclosure
C
Cisco Blogs
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Cloudflare Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
I
Intezer
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Fortinet All Blogs
Jina AI
Jina AI
V
Visual Studio Blog
L
LINUX DO - 热门话题
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏

辰渊尘站

713解锁节来辣!小米17全系,k90pm又能解bl了 - 辰渊尘站 服务器面板迁移:从宝塔到 1Panel - 辰渊尘站 Astro框架Fuwari主题侧边栏添加Umami访问统计 Astro框架Fuwari主题侧边栏添加Umami访问统计 为Fuwari框架适配友链状态显示 为Fuwari框架适配友链状态显示 免费领取网易云音乐7天会员 免费领取网易云音乐7天会员 小米MiMo Token Plan免费送辣! 小米MiMo Token Plan免费送辣! Astro框架Fuwari主题实现仿hexo-abbrlink功能 Astro框架Fuwari主题实现仿hexo-abbrlink功能 观《鬼灭之刃:无限城篇 第一章 猗窝座再袭》首映有感 观《鬼灭之刃:无限城篇 第一章 猗窝座再袭》首映有感 为你anzhiyu主题的Twikoo评论系统恢复预览按钮 为你anzhiyu主题的Twikoo评论系统恢复预览按钮 山东泰安泰山游记:煌煌泰山景,谦谦君子风 山东泰安泰山游记:煌煌泰山景,谦谦君子风 安知鱼主题:修复背景图修改引发的深色模式可读性问题 安知鱼主题:修复背景图修改引发的深色模式可读性问题 安知鱼主题实现友链状态前端显示 安知鱼主题实现友链状态前端显示 我敲!优选DNS牛大了 我敲!优选DNS牛大了 安知鱼主题侧边栏添加无聊湾 安知鱼主题侧边栏添加无聊湾 从零开始使用Hexo框架搭建属于你的博客(一)环境准备篇 从零开始使用Hexo框架搭建属于你的博客(一)环境准备篇 记录下Hexo博客从本地构建迁移到Netlify,AI API Key 泄露问题与解决方案记录 记录下Hexo博客从本地构建迁移到Netlify,AI API Key 泄露问题与解决方案记录 云服务器宝塔部署Twikoo博客评论系统 云服务器宝塔部署Twikoo博客评论系统 手把手教你在Linux系统下部署MCSManager并搭建一个MC服务器 手把手教你在Linux系统下部署MCSManager并搭建一个MC服务器 为你的Twikoo添加酷安表情包 为你的Twikoo添加酷安表情包 记录一次博客评论迁移过程 记录一次博客评论迁移过程 记一次花嫁联名借记卡申领过程 记一次花嫁联名借记卡申领过程 为使用anzhiyu主题的博客加上十年之约进度条 为使用anzhiyu主题的博客加上十年之约进度条 有关建站一个月以来的一点点感想和后续计划 有关建站一个月以来的一点点感想和后续计划 这可能是iOS自签的版本答案,二合一LiveContainer教程来辣! 这可能是iOS自签的版本答案,二合一LiveContainer教程来辣! iOS侧载新选择!SideStore+LiveContainer,纯净无广,无限安装软件!!! iOS侧载新选择!SideStore+LiveContainer,纯净无广,无限安装软件!!! 从零开始使用Hexo框架搭建属于你的博客(零)准备篇 从零开始使用Hexo框架搭建属于你的博客(零)准备篇 Arch Linux+Hyprland从安装到使用只需这一篇(保姆级喂饭超全教程) Arch Linux+Hyprland从安装到使用只需这一篇(保姆级喂饭超全教程) - 辰渊尘站 恭喜你找到了本站的第一篇文档 恭喜你找到了本站的第一篇文档 - 辰渊尘站
Subconverter 太臃肿?PHP 版轻量化替代来了! - 辰渊尘站
辰渊尘 · 2026-06-17 · via 辰渊尘站
TIP

项目地址:

Waiting for api.github.com...

演示地址:https://sublite.mcxiaochen.top

前言#

订阅转换是个多代理用户的刚需——把多个代理的订阅合并成一个,生成一份统一的配置文件,导入到 Clash/mihomo 里使用。

说到订阅转换,大家首先想到的肯定是 tindy2013/subconverter,16.8k+ stars,功能非常全面,支持 Clash、Surge、Quantumult、Loon 等十几种客户端格式。

但问题是:我用不上这么多功能。

我只用 Clash/mihomo,不需要 Surge、不需要 Quantumult、不需要 Loon。我只需要把几个订阅合并成一份 mihomo 配置,仅此而已。原版的配置项和参数众多,对于这种简单需求来说,学习成本偏高。

所以我就写了这个 subconverter-lite——一个基于 PHP 的轻量化订阅转换工具,只做一件事,做好一件事。

项目介绍#

功能特点#

  • 轻量化设计:整个项目只有几个 PHP 文件,无需编译,直接部署
  • 简洁美观的前端:深色主题,JetBrains Mono 字体,交互直观
  • 支持多订阅合并:最多支持 10 个订阅链接合并
  • 支持多种代理协议:SS、SSR、VMess、VLESS、Trojan、Hysteria 等
  • 基于 mihomo 配置模板:开箱即用,可自定义

技术栈#

  • 后端:PHP >= 7.4 + curl 扩展
  • 前端:原生 HTML/CSS/JS,零框架依赖

与原版对比#

特性subconverter (原版)subconverter-lite
语言C++PHP
客户端支持15+ 种Clash/mihomo
部署方式编译 / Docker直接部署
配置复杂度
适用场景全客户端覆盖仅需 Clash/mihomo

如果你只用 Clash/mihomo,subconverter-lite 完全够用,而且更简单。

ScreenShot_2026-06-16_232723_053_ompress.webp

技术实现#

项目架构#

整体架构非常简单,一个请求流程如下:

flowchart TD A[用户请求] --> B{请求类型} B -->|前端页面| C[index.html] B -->|API 调用| D[api.php] D --> E[解析参数] E --> F[Subscription.php] F --> G[验证链接] G --> H[Converter.php] H --> I[加载模板] I --> J[替换 proxy-providers] J --> K[返回 YAML 配置]

项目结构:

subconverter-lite/

├── index.php # 入口文件(重定向到前端)

├── index.html # 前端页面

├── api.php # API 入口

├── config.php # 配置文件

├── src/

│ ├── Subscription.php # 订阅解析类

│ └── Converter.php # 转换器类

└── templates/

└── base.yaml # 基础模板

订阅解析(Subscription.php)#

Subscription 类负责订阅链接的验证和名称提取:

class Subscription

{

private int $timeout;

private string $userAgent;

public function __construct(int $timeout = 10, string $userAgent = '')

{

$this->timeout = $timeout;

$this->userAgent = $userAgent ?: 'clash-verge/v2.0.0';

}

// 验证订阅链接是否可访问

public function validate(string $url): bool

{

$ch = curl_init();

curl_setopt_array($ch, [

CURLOPT_URL => $url,

CURLOPT_RETURNTRANSFER => true,

CURLOPT_TIMEOUT => $this->timeout,

CURLOPT_FOLLOWLOCATION => true,

CURLOPT_NOBODY => true,

]);

curl_exec($ch);

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

return $httpCode === 200;

}

// 使用 crc32 生成唯一标识

public function extractName(string $url, int $index): string

{

$hash = sprintf('%x', crc32($url));

return "sub_{$hash}";

}

}

核心逻辑很简单:验证链接是否可访问,然后用 crc32 生成一个唯一名称作为 proxy-provider 的标识。

转换器(Converter.php)#

Converter 类负责加载模板并替换 proxy-providers:

class Converter

{

private string $templatePath;

public function __construct(string $templatePath)

{

$this->templatePath = $templatePath;

}

public function convert(array $subscriptions): string

{

// 加载模板

$template = file_get_contents($this->templatePath);

// 构建 proxy-providers 配置

$providers = [];

foreach ($subscriptions as $sub) {

$providers[] = sprintf(

' %s:\n type: http\n url: "%s"\n interval: 3600\n path: ./%s.yaml',

$sub['name'],

$sub['url'],

$sub['name']

);

}

// 替换模板中的 proxy-providers 占位符

$providerConfig = implode("\n", $providers);

$template = preg_replace(

'/proxy-providers:.*?(?=\n[a-zA-Z])/s',

"proxy-providers:\n" . $providerConfig . "\n",

$template

);

return $template;

}

}

核心逻辑:读取模板文件,把用户传入的订阅链接填充到 proxy-providers 配置中,返回最终的 YAML 配置。

API 设计#

API 入口 api.php 的参数设计非常直观:

单个订阅:

/api.php?sub_url=https://example.com/subscribe

多个订阅:

/api.php?sub_url_1=https://example.com/sub1&sub_url_2=https://example.com/sub2

自定义名称:

/api.php?sub_url_1=https://example.com/sub1&name_1=我的代理

最多支持 10 个订阅链接(sub_url_1sub_url_10),同时兼容单个 sub_url 参数。

前端实现#

前端采用深色主题设计,使用 JetBrains Mono 字体,整体风格简洁:

  • 输入框支持 URL 验证
  • 可添加多个订阅链接
  • 一键生成配置链接
  • 支持复制链接、下载配置、在 Clash 中打开

ScreenShot_2026-06-16_232755_921_ompress.webp

部署教程#

环境要求#

  • PHP >= 7.4
  • PHP curl 扩展

安装步骤#

1. 克隆项目

git clone https://github.com/mcxiaochenn/subconverter-lite.git

cd subconverter-lite

2. 安装 PHP curl 扩展

# Ubuntu/Debian

sudo apt-get install php-curl

# CentOS/RHEL

sudo yum install php-curl

3. 配置 Web 服务器

使用 Nginx 的话,配置一个简单的站点:

server {

listen 80;

server_name your-domain.com;

root /path/to/subconverter-lite;

index index.html index.php;

location / {

try_files $uri $uri/ /index.php;

}

location ~ \.php$ {

fastcgi_pass unix:/var/run/php/php-fpm.sock;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

}

或者使用 PHP 内置服务器快速测试:

配置说明#

编辑 config.php 可以修改以下配置:

return [

// 模板文件路径

'template_path' => __DIR__ . '/templates/base.yaml',

// 请求超时时间(秒)

'request_timeout' => 10,

// 用户代理

'user_agent' => 'clash-verge/v2.0.0',

];

模板文件 templates/base.yaml 基于 mihomo 配置格式,可以根据需要自定义。

使用方法#

方式一:前端页面(推荐)#

访问你的域名,会显示一个简洁的前端页面。输入订阅链接,点击”添加”,然后点击”生成配置”,即可获取订阅地址。

方式二:API 直接调用#

# 单个订阅

curl "https://your-domain.com/api.php?sub_url=https://example.com/subscribe"

# 多个订阅合并

curl "https://your-domain.com/api.php?sub_url_1=https://example.com/sub1&sub_url_2=https://example.com/sub2"

# 自定义代理名称

curl "https://your-domain.com/api.php?sub_url_1=https://example.com/sub1&name_1=我的代理"

生成的配置链接可以直接导入到 Clash/mihomo 中使用。

总结#

subconverter-lite 的定位很简单:只做订阅合并和配置生成,做好这一件事。

如果你和我一样,只用 Clash/mihomo,不需要支持十几种客户端格式,那么 subconverter-lite 可能更适合你。轻量化、易部署、够用就好。

最后再贴一下项目地址,欢迎 Star 和 PR:

Waiting for api.github.com...

演示地址:https://sublite.mcxiaochen.top