myphp-cli

中文文档
1.161.0发布于 2026/11/04MITTypeScriptES Module零依赖构建来源已验证

The myphp command line tool: create, develop and package MyPHP desktop apps

原始使用文档

myphp-cli

The myphp command of MyPHP for the scripts of a project's package.json, and the types of myphp.config.ts.

MyPHP's command line tool is PHP, part of the framework, which the project installs with Composer:

composer require owner888/myphp
npm install -D myphp-cli
{
  "scripts": {
    "dev": "myphp dev",
    "build": "myphp build"
  }
}

myphp runs, in this order, $MYPHP_CLI_BINARY when it is set; bin/myphp of the MyPHP checkout the package is part of (a file: dependency, as myphp init -template web writes it); else vendor/owner888/myphp/bin/myphp in the current directory or the nearest directory above it that has one. It needs PHP 8.3 or later with FFI.

defineConfig types the configuration of myphp.config.ts, which takes the place of myphp.json:

import { defineConfig } from "myphp-cli";

export default defineConfig({
  name: "My App",
  identifier: "com.example.myapp",
  devUrl: "http://localhost:5173",
});

版本与发布记录

myphp-cli 共发布 110 个版本,首次发布于 2026/10/26;过去 12 个月发布了 110 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.161.0latest2026/11/04今天
1.160.02026/11/04今天
1.159.02026/11/041 天前
1.146.02026/11/023 天前
1.145.02026/11/013 天前
1.143.02026/11/013 天前

关于 myphp-cli 的常见问题

myphp-cli 是什么?

The myphp command line tool: create, develop and package MyPHP desktop apps

如何安装 myphp-cli?

在项目目录运行 npm install myphp-cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 myphp,可以用 npx myphp 直接运行。

myphp-cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

myphp-cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

myphp-cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

myphp-cli 可以商用吗?

myphp-cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

myphp-cli 还在维护吗?

最新版本 1.161.0 发布于 2026/11/04(今天);至今共发布 110 个版本,其中过去 12 个月发布了 110 个;首次发布于 2026/10/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。