Environment Setup
NativePHP for Desktop and Mobile have reached v1!
On this page
#Requirements
- PHP 8.3+
- Laravel 11+
- A NativePHP for Mobile license
If you don't already have PHP installed on your machine, the most painless way to get PHP up and running on Mac and Windows is with Laravel Herd. It's fast and free!
#iOS Requirements
- macOS (required - iOS development is only possible on a Mac)
- Xcode 16.0 or later
- Xcode Command Line Tools
- Homebrew & CocoaPods
- Optional iOS device for testing
#Setting up iOS Development Environment
-
Install Xcode
- Download from the Mac App Store
- Minimum version: Xcode 16.0
-
Install Xcode Command Line Tools
Copied!xcode-select --installVerify installation:
Copied!xcode-select -p -
Install Homebrew (if not already installed)
Copied!/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install CocoaPods
Copied!brew install cocoapodsVerify installation:
Copied!pod --version
#Apple Developer Account
You do not need to enroll in the Apple Developer Program ($99/year) to develop and test your apps on a Simulator. However, you will need to enroll when you want to:
- Test your apps on real devices
- Distribute your apps via the App Store
#Android Requirements
- Android Studio 2024.2.1 or later
- Android SDK with API 23 or higher
- Windows only: You must have 7zip installed.
#Setting up Android Studio and SDK
-
Download and Install Android Studio
- Download from the Android Studio download page
- Minimum version required: Android Studio 2024.2.1
-
Install Android SDK
- Open Android Studio
- Navigate to Tools → SDK Manager
- In the SDK Platforms tab, install at least one Android SDK platform for API 23 or higher
- Latest stable version: Android 15 (API 35)
- You only need to install one API version to get started
- In the SDK Tools tab, ensure Android SDK Build-Tools and Android SDK Platform-Tools are installed
That's it! Android Studio handles all the necessary configuration automatically.
#Preparing for NativePHP
- Check that you can run
java -v
andadb devices
from the terminal. - The following environment variables set:
On macOS
export JAVA_HOME=$(/usr/libexec/java_home -v 17) // This isn't required if JAVA_HOME is already set in your environment variables (check using `printenv | grep JAVA_HOME`)export ANDROID_HOME=$HOME/Library/Android/sdkexport PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools
On Windows
set ANDROID_HOME=C:\Users\yourname\AppData\Local\Android\Sdkset PATH=%PATH%;%JAVA_HOME%\bin;%ANDROID_HOME%\platform-tools # This isn't required if JAVA_HOME is already set in the Windows Env Variablesset JAVA_HOME=C:\Program Files\Microsoft\jdk-17.0.8.7-hotspot
#Testing on Real Devices
You don't need a physical iOS/Android device to compile and test your application, as NativePHP for Mobile supports the iOS Simulator and Android emulators. However, we highly recommend that you test your application on a real device before submitting to the Apple App Store and Google Play Store.
#On iOS
If you want to run your app on a real iOS device, you need to make sure it is in Developer Mode and that it's been added to your Apple Developer account as a registered device.
#On Android
On Android you need to enable developer options and have USB debugging (ADB) enabled.