weswecan/nativephp-starter-kit
Composer 安装命令:
composer create-project weswecan/nativephp-starter-kit
包简介
Starterkit for NativePHP projects using inertia, typescript, sass, vue 3, and NativePHP Mobile
README 文档
README
A Laravel 12 starter kit configured for building native iOS and Android applications using NativePHP Mobile, with Vue 3 + Inertia, TypeScript, Ziggy route helpers, axios, and SCSS via Vite.
Stack
- Backend: Laravel 12, Inertia Laravel adapter v2
- Mobile: NativePHP Mobile v3.0
- Frontend: Vue 3 with script setup and TypeScript
- Bundler: Vite 7 +
laravel-vite-plugin+nativephpMobileplugin - Dev tools:
vite-plugin-vue-devtools - Routing helpers: Ziggy v2 (
@routesin Blade,ZiggyVuein Vue) - HTTP: Axios pre-configured in
bootstrap.ts - Styles: SCSS (global styles only; no styles inside SFCs)
- Testing: Pest v4
- DX: Laravel Pail (pretty app logs), Laravel Boost, and a queue worker wired in the dev script
Project layout (key files)
resources/js/app.ts: Inertia + Vue app bootstrap, imports../scss/index.scss, registersZiggyVueresources/js/bootstrap.ts: axios onwindow, setsX-Requested-Withresources/js/Pages/*.vue: Inertia pages (TypeScript SFCs)resources/js/Layouts/BasicLayout.vue: Base layout with<Head />resources/scss/index.scss: global styles (uses_variables.scss)resources/views/app.blade.php: Inertia root, includes@routes+@vitevite.config.js: Laravel + Vue + Vue DevTools + NativePHP Mobile pluginstsconfig.json: strict TS, path aliases (@/*,ziggy-js)config/nativephp.php: NativePHP Mobile configurationnative: Custom wrapper script for NativePHP commands (use./nativeinstead ofphp artisan native)
Conventions
- Vue SFCs: Always
script setup lang="ts"at the top, thentemplate. No<style>blocks in SFCs. - Styles: Put styles in
resources/scss/and import fromapp.ts. - Aliases: Use
@/forresources/js(configured intsconfig.json). - Routes: Use Ziggy's
route()in Vue (viaZiggyVue) and in Blade via@routes. - Page titles: Set by Inertia using
VITE_APP_NAMEfor suffix. - Package manager: Use Yarn (not npm) for all Node.js operations.
Prerequisites
- PHP 8.3+
- Composer
- Node 18+
- Yarn
- For iOS development: macOS with Xcode installed
- For Android development: Android Studio with Android SDK installed
Installation
composer install cp .env.example .env php artisan key:generate yarn install
NativePHP Setup
Before running your app, configure NativePHP in .env:
NATIVEPHP_APP_ID=com.yourcompany.yourapp NATIVEPHP_APP_VERSION=DEBUG NATIVEPHP_APP_VERSION_CODE=1 NATIVEPHP_DEVELOPMENT_TEAM=YOUR_TEAM_ID # iOS only, optional
Then install NativePHP dependencies:
php artisan native:install
Or use the custom wrapper:
./native install
Development Commands
Web Development (Browser)
Start development server (runs Laravel server, queue worker, Pail logs, and Vite):
composer run dev
Or run separately:
# Terminal 1: Laravel server php artisan serve # Terminal 2: Vite dev server yarn dev
Mobile Development (Native Apps)
Build for iOS:
yarn build:ios # or yarn run:ios # Builds and runs in one command
Build for Android:
yarn build:android # or yarn run:android # Builds and runs in one command
Run on device/emulator (builds first):
php artisan native:run ios
php artisan native:run android
# or use the wrapper
./native run ios
./native run android
Hot reloading (watches for changes and auto-reloads):
yarn watch # or specify platform yarn watch:ios yarn watch:android # or use artisan directly php artisan native:watch php artisan native:watch ios php artisan native:watch android
Run with watch (build, deploy, then watch):
yarn run:watch:ios
yarn run:watch:android
# or use artisan directly
php artisan native:run --watch ios
php artisan native:run --watch android
Open in Xcode/Android Studio:
php artisan native:open ios php artisan native:open android
View logs:
php artisan native:tail
Build Commands
Web build:
yarn build
Mobile builds (run before native:run):
yarn build:ios # Build assets for iOS yarn build:android # Build assets for Android
Testing
composer test # or php artisan test
Type Checking
Vue SFC-aware type-check:
yarn dlx vue-tsc --noEmit
Plain TypeScript (non-SFC):
yarn tsc --noEmit
Using Ziggy route helpers
- In Blade (already included):
@routes - In Vue (globally via
ZiggyVue):
route('index') route('posts.show', { post: 1 })
NativePHP Mobile Features
This starter kit includes NativePHP Mobile v3.0 configured with:
- Hot reloading: Changes to PHP, Vue, and assets are automatically pushed to the device
- Vite HMR: Full hot module replacement support for Vue components
- Platform detection: Use
System::isIos()andSystem::isAndroid()in PHP - Native APIs: Access to Camera, Biometrics, Scanner, Dialog, SecureStorage, and more
- EDGE Components: Native UI components via Blade (
native:bottom-nav,native:top-bar, etc.)
See the NativePHP Mobile documentation for full API reference.
Development Tips
- Keep
NATIVEPHP_APP_VERSION=DEBUGduring development to ensure Laravel always refreshes - Use hot reloading (
native:watch) for faster iteration - no need to rebuild after every change - Build assets first: Always run
yarn build:iosoryarn build:androidbeforenative:run - Real devices: Hot reloading works on real devices if they're on the same Wi-Fi network
- iOS limitations: Full hot reloading on real iOS devices has some limitations (works best on simulators)
Notes
- Axios is available as
window.axioswithX-Requested-Withset. - The Inertia progress bar is enabled with a gray color.
assetsInclude: ['**/*.glsl']is enabled in Vite if you import GLSL assets.- The
nativewrapper script allows shorter commands:./native run iosinstead ofphp artisan native:run ios - Composer
devscript uses Yarn internally (not npm)
What's included vs. not
- Included: Vue 3 + TS, Inertia v2, Ziggy v2, SCSS, Axios, Vite, Vue DevTools, Pest v4, Pail, queue worker in dev, NativePHP Mobile v3.0, Laravel Boost
- Not included: SSR, authentication scaffolding, ESLint/Prettier config
Resources
weswecan/nativephp-starter-kit 适用场景与选型建议
weswecan/nativephp-starter-kit 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「mobile」 「laravel」 「nativephp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 weswecan/nativephp-starter-kit 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 weswecan/nativephp-starter-kit 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 weswecan/nativephp-starter-kit 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Beyonic PHP Library
The skeleton application for NativePHP for Mobile.
PHP SDK for Mobile Message SMS API
Alfabank REST API integration
The Unifonic integration for the Yii framework
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-05