Skip to content

命令参考

NativePHP Mobile 中所有可用的 native:* Artisan 命令完整参考。

开发命令

native:install

将 NativePHP 安装到你的 Laravel 应用程序中。

shell
php artisan native:install {platform?}
选项描述
platform目标平台:androidiosboth
--force覆盖现有文件
--fresh--force 的别名
--with-icu为 Android 包含 ICU 支持(增加约 30MB)
--without-icu为 Android 排除 ICU 支持
--skip-php不下载 PHP 二进制文件

native:run

在设备或模拟器上构建并运行应用。

shell
php artisan native:run {os?} {udid?}
选项描述
os目标平台:iosandroid
udid特定设备/模拟器的 UDID
--build=debug构建类型:debugreleasebundle
--watch在开发期间启用热重载
--start-url=要加载的初始 URL/路径(例如 /dashboard
--no-tty为非交互式环境禁用 TTY 模式

native:watch

监视文件更改并同步到正在运行的移动应用。

shell
php artisan native:watch {platform?} {target?}
选项描述
platform目标平台:iosandroid
target要监视的设备/模拟器 UDID

native:jump

启动 NativePHP 开发服务器,无需构建即可测试移动应用。

shell
php artisan native:jump
选项描述
--platform=目标平台:androidios
--host=0.0.0.0服务器监听的主机地址
--http-port=服务器监听的 HTTP 端口
--laravel-port=8000要代理的 Laravel 开发服务器端口
--no-mdns禁用 mDNS 服务广播
--skip-build如果 app.zip 存在则跳过构建

native:open

在 Xcode 或 Android Studio 中打开原生项目。

shell
php artisan native:open {os?}
选项描述
os目标平台:iosandroid

native:tail

从正在运行的 Android 应用跟踪 Laravel 日志。(仅限 Android)

shell
php artisan native:tail

native:version

显示当前 NativePHP Mobile 版本。

shell
php artisan native:version

构建和发布命令

跳过复杂性

在本地管理证书、配置文件和密钥库既繁琐又容易出错。 Bifrost 为你处理所有这些——只需设置一次凭据,用一个命令部署,轻松与团队协作。

native:package

打包应用以进行签名分发。

shell
php artisan native:package {platform}
选项描述
platform目标平台:androidios
--build-type=release构建类型:releasebundle
--output=签名产物的输出目录
--jump-by=在版本编号中向前跳跃
--no-tty为非交互式环境禁用 TTY 模式

Android 选项:

选项描述
--keystore=Android 密钥库文件路径
--keystore-password=密钥库密码
--key-alias=签名的密钥别名
--key-password=密钥密码
--fcm-key=用于推送通知的 FCM 服务器密钥
--google-service-key=Google 服务账号密钥文件路径
--upload-to-play-store打包后上传到 Play Store
--play-store-track=internalPlay Store 轨道:internalalphabetaproduction
--test-push=使用现有 AAB 文件测试 Play Store 上传(跳过构建)
--skip-prepare跳过 prepareAndroidBuild() 以保留现有项目文件

iOS 选项:

选项描述
--export-method=app-store导出方法:app-storead-hocenterprisedevelopment
--upload-to-app-store打包后上传到 App Store Connect
--test-upload测试上传现有 IPA(跳过构建)
--validate-only仅验证归档而不导出
--validate-profile验证配置文件授权
--rebuild通过删除现有归档强制重建
--clean-caches构建前清除 Xcode 和 SPM 缓存
--api-key=App Store Connect API 密钥文件路径(.p8)
--api-key-id=App Store Connect API 密钥 ID
--api-issuer-id=App Store Connect API 发行者 ID
--certificate-path=分发证书路径(.p12/.cer)
--certificate-password=证书密码
--provisioning-profile-path=配置文件路径(.mobileprovision)
--team-id=Apple 开发者团队 ID

native:release

.env 文件中升级版本号。

shell
php artisan native:release {type}
选项描述
type发布类型:patchminormajor

native:credentials

为 iOS 和 Android 生成签名凭据。

shell
php artisan native:credentials {platform?}
选项描述
platform目标平台:androidiosboth
--reset生成新的密钥库和 PEM 证书

native:check-build-number

验证并建议应用的构建编号。

shell
php artisan native:check-build-number

插件命令

native:plugin:create

以交互方式创建新的 NativePHP 插件脚手架。

shell
php artisan native:plugin:create

native:plugin:list

列出所有已安装的 NativePHP 插件。

shell
php artisan native:plugin:list
选项描述
--json以 JSON 格式输出
--all显示所有已安装的插件,包括未注册的

native:plugin:register

在 NativeServiceProvider 中注册插件。

shell
php artisan native:plugin:register {plugin}
选项描述
plugin包名(例如 vendor/plugin-name
--remove移除插件而不是添加它
--force跳过冲突警告

native:plugin:uninstall

完全卸载插件。

shell
php artisan native:plugin:uninstall {plugin}
选项描述
plugin包名(例如 vendor/plugin-name
--force跳过确认提示
--keep-files不删除插件源目录

native:plugin:validate

验证插件的结构和清单。

shell
php artisan native:plugin:validate {path?}
选项描述
path特定插件目录的路径

native:plugin:make-hook

为插件创建生命周期钩子命令。

shell
php artisan native:plugin:make-hook

native:plugin:boost

为插件创建 Boost AI 指南。

shell
php artisan native:plugin:boost {plugin?}
选项描述
plugin插件名称或路径
--force覆盖现有指南

native:plugin:install-agent

安装用于插件开发的 AI 代理。

shell
php artisan native:plugin:install-agent
选项描述
--force覆盖现有代理文件
--all安装所有代理而不提示

基于 NativePHP 官方文档翻译