Environment Setup


#Requirements

  1. PHP 8.3+
  2. Laravel 11+
  3. 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

  1. macOS (required - iOS development is only possible on a Mac)
  2. Xcode 16.0 or later
  3. Xcode Command Line Tools
  4. Homebrew & CocoaPods
  5. Optional iOS device for testing

#Setting up iOS Development Environment

  1. Install Xcode

  2. Install Xcode Command Line Tools

    Copied!
    xcode-select --install

    Verify installation:

    Copied!
    xcode-select -p
  3. Install Homebrew (if not already installed)

    Copied!
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  4. Install CocoaPods

    Copied!
    brew install cocoapods

    Verify 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

  1. Android Studio 2024.2.1 or later
  2. Android SDK with API 23 or higher
  3. Windows only: You must have 7zip installed.

#Setting up Android Studio and SDK

  1. Download and Install Android Studio

  2. 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

  1. Check that you can run java -v and adb devices from the terminal.
  2. The following environment variables set:

On macOS

Copied!
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/sdk
export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools

On Windows

Copied!
set ANDROID_HOME=C:\Users\yourname\AppData\Local\Android\Sdk
set PATH=%PATH%;%JAVA_HOME%\bin;%ANDROID_HOME%\platform-tools
 
# This isn't required if JAVA_HOME is already set in the Windows Env Variables
set 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.