NativePHP 可讓你無需耗費大量時間設定 Xcode 或 Android Studio。你只需要在 iOS 或 Android 裝置安裝 Jump 應用程式即可。
執行下列指令以建立全新 Laravel 專案
laravel new my-app --using=nativephp/mobile-starter
cd my-app
php artisan native:jumpCode language: JavaScript (javascript)
備註:執行這些指令前,請先安裝好 Laravel。
如何安裝 Laravel?
Laravel 到底是什麼?
Laravel 是一款人氣極高、易於使用的 PHP 網站框架。內建帳號登入與註冊、檔案上傳、信件發送、資料庫操作及表單驗證等工具,能大幅加快 PHP 開發速度。
由於 Laravel 仰賴 PHP 執行,請先完成 PHP 環境建置。另外請留意版本規範,舊版 PHP 無法執行新版 Laravel。
PHP 版本 ≥ 8.1(建議使用 8.2 ~ 8.4)
安裝 PHP
請參考這篇專屬教學來安裝 PHP:
安裝 Composer
Composer 是 PHP 的套件管理工具,類似 .NET 的 NuGet 或是 Java 的 Maven、Gradle。
安裝步驟請參考另一篇獨立教學。
安裝 PHP 套件管理工具 Composer – FoxDevelop
確認 PHP 與 Composer 皆安裝完成後,接下來就能開始安裝 Laravel。
開啟命令提示字元,先檢查軟體版本。
PHP 版本需求:PHP ≥ 8.1(優選 8.2 / 8.5),執行 php -v 查看版本
Composer 版本需求:Composer ≥ 2.5,執行 composer -V 查看版本
接著檢查必要的 PHP 擴充功能:
php -m | findstr mbstring
php -m | findstr openssl
php -m | findstr pdo
中國地區使用者可切換至阿里雲鏡像來解決下載緩慢問題。請在命令提示字元貼上以下指令:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/Code language: JavaScript (javascript)
接著使用 create-project 指令開始安裝:
composer create-project laravel/laravel myproject
cd myproject
這裡因為缺少 zip 擴充功能而出現錯誤。如果你的安裝流程順利,可跳過下方除錯步驟,直接前往此處。
錯誤訊息如下:
C:\Users\xxxx>composer create-project laravel/laravel myproject
Creating a "laravel/laravel" project at "./myproject"
Installing laravel/laravel (v12.10.0)
Failed to download laravel/laravel from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: D:\php8.2\php.ini
Now trying to download from source
- Syncing laravel/laravel (v12.10.0) into cacheCode language: JavaScript (javascript)
在命令提示字元執行下列指令,確認 zip 擴充功能未安裝:
php -m | findstr zip
若沒有任何輸出,代表 zip 擴充功能尚未啟用。
編輯 php.ini 以啟用 zip 擴充功能
我的 PHP 設定檔路徑:D:\php8.2\php.ini
找到 ;extension=zip,刪除開頭的分號。
再次在命令提示字元執行 php -m | findstr zip,出現內容即代表擴充功能已正常啟用。
隨後重新執行安裝作業
再次執行安裝指令:
composer create-project laravel/laravel myproject
安裝再度失敗,執行紀錄如下:
composer create-project laravel/laravel myproject
Creating a "laravel/laravel" project at "./myproject"
Installing laravel/laravel (v12.10.0)
- Downloading laravel/laravel (v12.10.0)
Failed downloading laravel/laravel, trying the next URL (404: The "https://mirrors.aliyun.com/composer/dists/laravel/laravel/76396a056d552b8a34077f151775037ac44b431a.zip" file could not be downloaded (HTTP/2 404 ))
- Downloading laravel/laravel (v12.10.0)
- Installing laravel/laravel (v12.10.0): Extracting archive
Created project in C:\Users\maiwu\myproject
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires laravel/tinker ^2.10.1, it is satisfiable by laravel/tinker[v2.10.1, v2.10.2, v2.11.0, v2.11.1] from composer repo (https://repo.packagist.org) but laravel/tinker[2.x-dev] from composer repo (https://mirrors.aliyun.com/composer) has higher repository priority. The packages from the higher priority repository do not match your minimum-stability and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
Problem 2
- Root composer.json requires phpunit/phpunit ^11.5.3, found phpunit/phpunit[11.5.3, ..., 11.5.44] but these were not loaded, because they are affected by security advisories ("PKSA-z3gr-8qht-p93v", "PKSA-z3gr-8qht-p93v"). Go to https://packagist.org/security-advisories/ to find advisory details. To ignore the advisories, add them to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.
Problem 3
- Root composer.json requires laravel/sail ^1.41 -> satisfiable by laravel/sail[v1.41.0, ..., v1.46.0].
- laravel/sail[v1.41.0, ..., v1.46.0] require symfony/yaml ^6.0|^7.0 -> found symfony/yaml[v6.0.0, ..., v6.4.30, v7.0.0, ..., v7.4.1] but these were not loaded, because they are affected by security advisories ("PKSA-v5yj-8nmz-sk2q", "PKSA-ft77-7h5f-p3r6", "PKSA-b14r-zh1d-vdrc", "PKSA-v5yj-8nmz-sk2q", "PKSA-ft77-7h5f-p3r6", "PKSA-b14r-zh1d-vdrc"). Go to https://packagist.org/security-advisories/ to find advisory details. To ignore the advisories, add them to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.
Problem 4
- Root composer.json requires laravel/framework ^12.0 -> satisfiable by laravel/framework[v12.1.1, ..., v12.40.0].
- laravel/framework[v12.1.1, ..., v12.12.0] require league/commonmark ^2.6 -> found league/commonmark[2.6.0] but these were not loaded, because they are affected by security advisories ("PKSA-21fb-n1x5-5nf7", "PKSA-2cx9-ynrq-qdk3", "PKSA-rqc2-tcc6-nc79", "PKSA-21fb-n1x5-5nf7", "PKSA-2cx9-ynrq-qdk3", "PKSA-rqc2-tcc6-nc79"). Go to https://packagist.org/security-advisories/ to find advisory details. To ignore the advisories, add them to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.
- laravel/framework[v12.13.0, ..., v12.40.0] require league/commonmark ^2.7 -> satisfiable by league/commonmark[2.7.0, ..., 2.8.2] from composer repo (https://repo.packagist.org) but league/commonmark[dev-main, 2.7.x-dev, 2.8.x-dev, 2.9.x-dev (alias of dev-main)] from composer repo (https://mirrors.aliyun.com/composer) has higher repository priority. The packages from the higher priority repository do not match your minimum-stability and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.Code language: PHP (php)
原因:阿里雲 Composer 鏡像站點異常。
先刪除異常的專案資料夾,再切換回官方來源:
rmdir /s /q myproject
composer config -g --unset repos.packagist
composer create-project laravel/laravel myproject --no-auditCode language: PHP (php)
安裝依然失敗,請再次清理殘留檔案:
- Downloading phpunit/php-code-coverage (11.0.12)
- Downloading phar-io/version (3.2.1)
- Downloading phar-io/manifest (2.0.4)
- Downloading myclabs/deep-copy (1.13.4)
- Downloading phpunit/phpunit (11.5.55)
110/111 [===========================>] 99%A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.
Failed to download laravel/pint from dist: The "https://codeload.github.com/laravel/pint/legacy.zip/0770e9b7fafd50d4586881d456d6eb41c9247a80" file could not be written to C:\Users\maiwu\myproject/vendor/composer/tmp-60f6b8b4815321558e13bb1ac74423ee.zip: Failed to open stream: Permission denied
Now trying to download from source
- Syncing laravel/pint (v1.29.1) into cache
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
You need to provide a GitHub access token.
Tokens will be stored in plain text in "C:/Users/maiwu/AppData/Roaming/Composer/auth.json" for future use by Composer.
Due to the security risk of tokens being exfiltrated, use tokens with short expiration times and only the minimum permissions necessary.
Carefully consider the following options in order:
1. When you don't use 'vcs' type 'repositories' in composer.json and do not need to clone source or download dist files
from private GitHub repositories over HTTPS, use a fine-grained token with read-only access to public information.
Use the following URL to create such a token:
https://github.com/settings/personal-access-tokens/new?name=Composer+on+DESKTOP-1OHC5Q4+2026-05-27+0946
2. When all relevant _private_ GitHub repositories belong to a single user or organisation, use a fine-grained token with
repository "content" read-only permissions. You can start with the following URL, but you may need to change the resource owner
to the right user or organisation. Additionally, you can scope permissions down to apply only to selected repositories.
https://github.com/settings/personal-access-tokens/new?contents=read&name=Composer+on+DESKTOP-1OHC5Q4+2026-05-27+0946
3. A "classic" token grants broad permissions on your behalf to all repositories accessible by you.
This may include write permissions, even though not needed by Composer. Use it only when you need to access
private repositories across multiple organisations at the same time and using directory-specific authentication sources
is not an option. You can generate a classic token here:
https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+DESKTOP-1OHC5Q4+2026-05-27+0946
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):Code language: PHP (php)
接著執行修改後的安裝指令:
composer create-project laravel/laravel myproject --no-dev --no-audit
使用此指令安裝可避免跳出 GitHub 權杖提示,並略過額外相依套件:
加入 –no-dev 與 –no-audit 參數,跳過會觸發 GitHub 原始碼下載的 pint、phpunit 套件。
出現類似以下內容即代表安裝成功:
- Installing league/commonmark (2.8.2): Extracting archive
- Installing laravel/framework (v12.61.0): Extracting archive
75 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package sebastian/code-unit is abandoned, you should avoid using it. No replacement was suggested.
Package sebastian/code-unit-reverse-lookup is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
INFO Discovering packages.
laravel/tinker .............................................................................................................................. DONE
nesbot/carbon ............................................................................................................................... DONE
nunomaduro/termwind ......................................................................................................................... DONECode language: JavaScript (javascript)
接下來測試剛建立的專案,上述指令會自動建立 myproject 資料夾並存放所有原始檔。
在目前的命令提示字元視窗中執行以下兩行指令:
cd myproject
php artisan serve
命令提示字元畫面會顯示如下:
C:\Users\xxxx>cd myproject
C:\Users\xxxx\myproject>php artisan serve
INFO Server running on [http://127.0.0.1:8000].
Press Ctrl+C to stop the server
Code language: JavaScript (javascript)
將 http://127.0.0.1:8000 貼到瀏覽器網址列,即可看到 Laravel 預設首頁。
