Skip to content

V1 docs #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/views/components/alert-v1-announcement.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class="hidden size-5 shrink-0 dark:block"
</div>

{{-- Title --}}
<h2 class="font-medium">NativePHP for desktop has finally reached v1!</h2>
<h2 class="font-medium">NativePHP for desktop and mobile have reached v1!</h2>

{{-- Dot 1 --}}
<div
Expand Down
48 changes: 47 additions & 1 deletion resources/views/docs/mobile/1/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,50 @@ title: Configuration
order: 200
---

# COMING SOON
## Overview

NativePHP for Mobile is designed so that most configuration happens **inside your Laravel application**, without requiring you to manually open Xcode or Android Studio.

After installation, NativePHP sets up the necessary native scaffolding, but your primary interaction remains inside Laravel itself.

This page explains the key configuration points you can control directly through Laravel.

## The `nativephp.php` Config File

The nativephp.php config file is where you can configure the native project for your application.

NativePHP uses sensible defaults and makes several assumptions based on default installations for tools required to build and run apps from your computer.

You can override these defaults by editing the `nativephp.php` config file in your Laravel project or changing environment variables.

```dotenv
NATIVEPHP_APP_VERSION
NATIVEPHP_APP_VERSION_CODE
NATIVEPHP_APP_ID
NATIVEPHP_DEEPLINK_SCHEME
NATIVEPHP_DEEPLINK_HOST
NATIVEPHP_APP_AUTHOR
NATIVEPHP_GRADLE_PATH
NATIVEPHP_ANDROID_SDK_LOCATION
```

## Cleanup `env` keys

The `cleanup_env_keys` array in the config file allows you to specify keys that should be removed from the `.env` file before bundling.
This is useful for removing sensitive information like API keys or other secrets.

## Cleanup `exclude_files`

The `cleanup_exclude_files` array in the config file allows you to specify files and folders that should be removed before bundling.
This is useful for removing files like logs or other temporary files.

## Permissions
In general, the app stores don't want apps to request permissions that they don't need.
To enable some permissions your app needs you simply need to change their values in the permissions section.

```dotenv
biometric
camera
nfc
push_notifications
```
33 changes: 32 additions & 1 deletion resources/views/docs/mobile/1/getting-started/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,36 @@ title: Development
order: 300
---

# COMING SOON

## The `nativephp` Directory

After running:

```bash
php artisan native:install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it references the command and we don't need to run it in this part of the documentation. I will use an inline code block instead of a full code block.

```

you’ll see a new `nativephp` directory at the root of your Laravel project as well as a nativephp.php config file in your config folder in the Laravel root.

This folder contains all the native project files that NativePHP generates for you.

You should not need to manually open or edit any native project files under normal circumstances.
NativePHP handles the heavy lifting for you.

## NATIVEPHP_APP_VERSION

The NATIVEPHP_APP_VERSION environment variable controls your app's versioning behavior.

When building for Android, NativePHP first copies the relevant Laravel files into a temporary directory, zips them, and embeds the archive into the Android project. When the app boots, it checks the embedded version against the previously installed version.

If the versions match, the app uses the existing files without re-extracting the archive.

If the versions differ — or if the version is set to ***DEBUG*** — the app updates itself by re-extracting the new bundle.

This mechanism ensures developers can iterate quickly during development, while providing a faster, more stable experience for end users once an app is published.

> Rule of Thumb:
> During development, keep NATIVEPHP_APP_VERSION set to DEBUG to always refresh the app.
> When preparing a new release, update it to a semantic version (e.g., 1.2.3) to enable versioned updates for your users.


94 changes: 57 additions & 37 deletions resources/views/docs/mobile/1/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,52 @@ order: 100

## Requirements

Right now, NativePHP for mobile only supports building iOS applications. Android is in the works already and coming soon!

Apple's tooling for building iOS apps requires that you compile your applications using macOS.

1. PHP 8.3+
2. Laravel 10 or higher
3. An Apple Silicon Mac running macOS 12+ with Xcode 16+
4. An active [Apple Developer account](https://developer.apple.com/)
5. [A NativePHP for iOS license](https://checkout.anystack.sh/nativephp-ios)
6. _Optional_ iOS device
3. [A NativePHP for mobile license](https://checkout.anystack.sh/nativephp-ios)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible wrong link also as mentioned by Pete

6. _Optional_ iOS/Android device

You don't _need_ a physical iOS device to compile your application and test it for iOS, as NativePHP for mobile supports
the iOS Simulator. However, we highly recommend that you test your application on a real device before submitting to the
App Store.
#### For iOS
1. An Apple Mac (ideally Silicon) running macOS 12+ with Xcode 16+
2. An active [Apple Developer account](https://developer.apple.com/)
3. You can download Xcode from the Mac App Store.

You can download Xcode from the Mac App Store.
#### For Android
1. [Android Studio Giraffe (or later)](https://developer.android.com/studio)
2. The following environment variables set.
3. You should be able to successfully run `java -v` and `adb devices` from the terminal.
4. **Windows only**: You must have [7zip](https://www.7-zip.org/) installed.

The most painless way to get PHP and Node up and running on your system is with
[Laravel Herd](https://herd.laravel.com). It's fast and free!
#### For macOS
```shell
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools
```

### Laravel
#### For Windows
```shell
set JAVA_HOME=C:\Program Files\Microsoft\jdk-17.0.8.7-hotspot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this can be replaced with a programatic approach? I'm not sure everyone will have 17.0.8.7 specifically? Not a blocker, just an observation.

Is it possible this isn't required if JAVA_HOME is already set in the Windows Env Variables?

set ANDROID_SDK_ROOT=C:\Users\yourname\AppData\Local\Android\Sdk
set PATH=%PATH%;%JAVA_HOME%\bin;%ANDROID_SDK_ROOT%\platform-tools
```

> **Note** You cannot build iOS apps on Windows or Linux

NativePHP for mobile is built to work best with Laravel. You can install it into an existing Laravel application, or
[start a new one](https://laravel.com/docs/installation).
You don't _need_ a physical iOS/Android device to compile your application and test it for your app, 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
App/Google Play Store.

## Laravel

NativePHP for mobile is built to work with Laravel. You can install it into an existing Laravel application, or
[start a new one](https://laravel.com/docs/installation). The most painless way to get PHP and Node up and running on your system is with
[Laravel Herd](https://herd.laravel.com). It's fast and free!

## Private package
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will merge the Private package and Install NativePHP for mobile sections.


To make NativePHP for mobile a reality has taken a lot of work and will continue to require even more. For this reason,
it's not open source and you are not free to distribute or modify its source code.
it's not open source, and you are not free to distribute or modify its source code.

Before you begin, you will need to purchase a license.
Licenses can be obtained via [Anystack](https://checkout.anystack.sh/nativephp-ios).
Expand All @@ -44,24 +61,29 @@ Once you have your license, you will need to add the following to your `composer
"repositories": [
{
"type": "composer",
"url": "https://nativephp-ios.composer.sh"
"url": "https://nativephp.composer.sh"
}
],
```

## Install NativePHP for iOS
## Install NativePHP for mobile

```shell
composer require nativephp/ios
composer require nativephp/mobile
```
This package contains all the libraries, classes, commands, and interfaces that your application will need to work with
iOS.

If this is the first time you're installing the package, you will be prompted to authenticate.
If this is the first time you're installing the package, you will be prompted to authenticate. Your username is the email address you registered with Anystack. Your password is your license key.

Your username is the email address you registered with Anystack.
This package contains all the libraries, classes, commands, and interfaces that your application will need to work with
iOS and Android.

Your password is your license key.
Before running the `install` command it is important to set the following variables in your `.env`:

```shell
NATIVEPHP_APP_ID=com.nativephp.yourapp
NATIVEPHP_APP_VERSION="DEBUG"
NATIVEPHP_APP_VERSION_CODE="1"
```

## Run the NativePHP installer

Expand All @@ -70,11 +92,7 @@ php artisan native:install
```

The NativePHP installer works similarly to NativePHP for desktop, taking care of setting up and configuring your Laravel
application to work with iOS.

After you've run this command, you'll see a new `ios` folder in the root of your Laravel project.

We'll come back to this later.
application to work with iOS and/or Android.

## Start your app

Expand All @@ -87,16 +105,15 @@ Once you're ready:
php artisan native:run
```

This will start compiling your application and boot it in the iOS Simulator by default.
This will start compiling your application and boot it in whichever device you select.

### Running on a real device

If you want to run your app on a real iOS device, you need to make sure the device is in
[Developer Mode](https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device) and that it's
been added to your Apple Developer account as
[a registered device](https://developer.apple.com/account/resources/devices/list).
#### For iOS
If you want to run your app on a real mobile device, you need to make sure the device is in
[Developer Mode](https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device) and that it's been added to your Apple Developer account as [a registered device](https://developer.apple.com/account/resources/devices/list).

You will need to get the device's UDID. You can find this by connecting the device to your Mac and opening it in the
For iOS: You will need to get the device's UDID. You can find this by connecting the device to your Mac and opening it in the
Finder. Click on model name at the top until the UDID appears, then right-click on it to copy it.

Then you can simply run, replacing `{UDID}` with your device's UDID:
Expand All @@ -107,4 +124,7 @@ php artisan native:run {UDID}

Alternatively, you may open the `ios/NativePHP.xcodeproj` file in Xcode and run builds using Xcode's UI.

#### For Android
On Android you need [enable developer options](https://developer.android.com/studio/debug/dev-options#enable) and have USB debugging (ADB) enabled.

And that's it! You should now see your Laravel application running as a native app! 🎉
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ We've combined the statically compiling PHP as an embeddable C library with the
native APIs of each support platform, unlocking the power and convenience of Laravel for building performant, native
_mobile_ applications using PHP.

**It's never been this easy to build beautiful, local-first apps for iOS and Android (coming soon).**
**It's never been this easy to build beautiful, local-first apps for iOS and Android.**

## Old tools, new tricks

Expand Down
49 changes: 43 additions & 6 deletions resources/views/docs/mobile/1/getting-started/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,48 @@ order: 099

## Current Status

NativePHP for mobile is `beta` software. We believe it's already robust enough to build useful applications that can be
distributed to users, so we've made it available via an [Early Access Program](/ios).
NativePHP for mobile v1 is here. While we're still in the process of adding more and more
native API's and other features we believe it's robust enough to build useful applications that can be
distributed to users.

The `beta` phase gives us the opportunity to work with the community to build more features and iron out issues.
Presently, NativePHP for mobile offers the following "native" functionality:

- Vibrate
- Show Toasts
- Show Alerts
- Share
- Camera
- Flashlight
- Biometric ID
- Push Notifications
- Deep Links
- NFC

We're working on adding more and more features, including:
- Secure Storage
- Microphone access
- Location
- Bluetooth
- SMS (Android only)
- File picker
- Video camera access
- Background tasks
- Geofencing
- Native image picker
- Calendar access
- Local notifications, scheduled notifications
- Clipboard API
- Contacts access
- App badges
- OTA Updates
- App review prompt
- Proximity sensor
- Gyroscope
- Accelerometer
- Screen brightness
- Haptic feedback
- Network info access
- Battery status
- CPU information
- Ads

If you're in the Early Access Program, please be sure to share your findings by
[raising issues](https://github.com/nativephp/ios/issues/new/choose)/reporting bugs, and on the `#early-access`
[Discord](https://discord.gg/X62tWNStZK) channel.
Loading