Skip to content

Commit cf223d5

Browse files
committed
First pass at docs
1 parent 6e0862e commit cf223d5

File tree

8 files changed

+206
-79
lines changed

8 files changed

+206
-79
lines changed

resources/views/docs/index.blade.php

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
<x-separator class="mt-4" />
1515

16-
<x-alert-beta />
17-
1816
{{-- Table of contents --}}
1917
<div class="xl:hidden">
2018
<h3 class="inline-flex items-center gap-1.5 pt-5 text-sm opacity-50">

resources/views/docs/mobile/1/getting-started/configuration.md

+46-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,49 @@ title: Configuration
33
order: 200
44
---
55

6-
# COMING SOON
6+
## Overview
7+
8+
NativePHP for Mobile is designed so that most configuration happens **inside your Laravel application**, without requiring you to manually open Xcode or Android Studio.
9+
10+
After installation, NativePHP sets up the necessary native scaffolding, but your primary interaction remains inside Laravel itself.
11+
12+
This page explains the key configuration points you can control directly through Laravel.
13+
14+
## The `nativephp.php` Config File
15+
16+
The nativephp.php config file is where you can configure the native project for your application.
17+
18+
NativePHP uses sensible defaults and makes several assumptions based on default installations for tools required to build and run apps from your computer.
19+
20+
You can override these defaults by editing the `nativephp.php` config file in your Laravel project or changing environment variables.
21+
22+
```dotenv
23+
NATIVEPHP_APP_VERSION
24+
NATIVEPHP_APP_VERSION_CODE
25+
NATIVEPHP_APP_ID
26+
NATIVEPHP_DEEPLINK_SCHEME
27+
NATIVEPHP_DEEPLINK_HOST
28+
NATIVEPHP_APP_AUTHOR
29+
NATIVEPHP_GRADLE_PATH
30+
NATIVEPHP_ANDROID_SDK_LOCATION
31+
```
32+
33+
## Cleanup `env` keys
34+
35+
The `cleanup_env_keys` array in the config file allows you to specify keys that should be removed from the `.env` file before bundling.
36+
This is useful for removing sensitive information like API keys or other secrets.
37+
38+
## Cleanup `exclude_files`
39+
40+
The `cleanup_exclude_files` array in the config file allows you to specify files and folders that should be removed before bundling.
41+
This is useful for removing files like logs or other temporary files.
42+
43+
## Permissions
44+
In general, the app stores don't want apps to request permissions that they don't need.
45+
To enable some permissions your app needs you simply need to change their values in the permissions section.
46+
47+
```dotenv
48+
push_notifications
49+
biometric
50+
nfc
51+
```

resources/views/docs/mobile/1/getting-started/development.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,36 @@ title: Development
33
order: 300
44
---
55

6-
# COMING SOON
6+
7+
## The `nativephp` Directory
8+
9+
After running:
10+
11+
```bash
12+
php artisan native:install
13+
```
14+
15+
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.
16+
17+
This folder contains all the native project files that NativePHP generates for you.
18+
19+
You should not need to manually open or edit any native project files under normal circumstances.
20+
NativePHP handles the heavy lifting for you.
21+
22+
## NATIVEPHP_APP_VERSION
23+
24+
The NATIVEPHP_APP_VERSION environment variable controls your app's versioning behavior.
25+
26+
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.
27+
28+
If the versions match, the app uses the existing files without re-extracting the archive.
29+
30+
If the versions differ — or if the version is set to ***DEBUG*** — the app updates itself by re-extracting the new bundle.
31+
32+
This mechanism ensures developers can iterate quickly during development, while providing a faster, more stable experience for end users once an app is published.
33+
34+
> Rule of Thumb:
35+
> During development, keep NATIVEPHP_APP_VERSION set to DEBUG to always refresh the app.
36+
> When preparing a new release, update it to a semantic version (e.g., 1.2.3) to enable versioned updates for your users.
37+
738

resources/views/docs/mobile/1/getting-started/installation.md

+56-37
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,51 @@ order: 100
55

66
## Requirements
77

8-
Right now, NativePHP for mobile only supports building iOS applications. Android is in the works already and coming soon!
9-
10-
Apple's tooling for building iOS apps requires that you compile your applications using macOS.
11-
128
1. PHP 8.3+
139
2. Laravel 10 or higher
14-
3. An Apple Silicon Mac running macOS 12+ with Xcode 16+
15-
4. An active [Apple Developer account](https://developer.apple.com/)
16-
5. [A NativePHP for iOS license](https://checkout.anystack.sh/nativephp-ios)
17-
6. _Optional_ iOS device
10+
3. [A NativePHP for mobile license](https://checkout.anystack.sh/nativephp-ios)
11+
6. _Optional_ iOS/Android device
1812

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

23-
You can download Xcode from the Mac App Store.
18+
#### For Android
19+
1. [Android Studio Giraffe (or later)](https://developer.android.com/studio)
20+
2. The following environment variables set.
21+
3. You should be able to successfully run `java -v` and `adb devices` from the terminal.
2422

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

28-
### Laravel
30+
#### For Windows
31+
```shell
32+
set JAVA_HOME=C:\Program Files\Microsoft\jdk-17.0.8.7-hotspot
33+
set ANDROID_SDK_ROOT=C:\Users\yourname\AppData\Local\Android\Sdk
34+
set PATH=%PATH%;%JAVA_HOME%\bin;%ANDROID_SDK_ROOT%\platform-tools
35+
```
36+
37+
> **Note** You cannot build iOS apps on Windows or Linux
2938
30-
NativePHP for mobile is built to work best with Laravel. You can install it into an existing Laravel application, or
31-
[start a new one](https://laravel.com/docs/installation).
39+
You don't _need_ a physical iOS/Android device to compile your application and test it for your app, as NativePHP for mobile supports
40+
the iOS Simulator and Android emulators. However, we highly recommend that you test your application on a real device before submitting to the
41+
App/Google Play Store.
42+
43+
## Laravel
44+
45+
NativePHP for mobile is built to work with Laravel. You can install it into an existing Laravel application, or
46+
[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
47+
[Laravel Herd](https://herd.laravel.com). It's fast and free!
3248

3349
## Private package
3450

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

3854
Before you begin, you will need to purchase a license.
3955
Licenses can be obtained via [Anystack](https://checkout.anystack.sh/nativephp-ios).
@@ -44,24 +60,29 @@ Once you have your license, you will need to add the following to your `composer
4460
"repositories": [
4561
{
4662
"type": "composer",
47-
"url": "https://nativephp-ios.composer.sh"
63+
"url": "https://nativephp.composer.sh"
4864
}
4965
],
5066
```
5167

52-
## Install NativePHP for iOS
68+
## Install NativePHP for mobile
5369

5470
```shell
55-
composer require nativephp/ios
71+
composer require nativephp/mobile
5672
```
57-
This package contains all the libraries, classes, commands, and interfaces that your application will need to work with
58-
iOS.
5973

60-
If this is the first time you're installing the package, you will be prompted to authenticate.
74+
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.
6175

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

64-
Your password is your license key.
79+
Before running the `install` command it is important to set the following variables in your `.env`:
80+
81+
```shell
82+
NATIVEPHP_APP_ID=com.nativephp.yourapp
83+
NATIVEPHP_APP_VERSION="DEBUG"
84+
NATIVEPHP_APP_VERSION_CODE="1"
85+
```
6586

6687
## Run the NativePHP installer
6788

@@ -70,11 +91,7 @@ php artisan native:install
7091
```
7192

7293
The NativePHP installer works similarly to NativePHP for desktop, taking care of setting up and configuring your Laravel
73-
application to work with iOS.
74-
75-
After you've run this command, you'll see a new `ios` folder in the root of your Laravel project.
76-
77-
We'll come back to this later.
94+
application to work with iOS and/or Android.
7895

7996
## Start your app
8097

@@ -87,16 +104,15 @@ Once you're ready:
87104
php artisan native:run
88105
```
89106

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

92109
### Running on a real device
93110

94-
If you want to run your app on a real iOS device, you need to make sure the device is in
95-
[Developer Mode](https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device) and that it's
96-
been added to your Apple Developer account as
97-
[a registered device](https://developer.apple.com/account/resources/devices/list).
111+
#### For iOS
112+
If you want to run your app on a real mobile device, you need to make sure the device is in
113+
[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).
98114

99-
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
115+
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
100116
Finder. Click on model name at the top until the UDID appears, then right-click on it to copy it.
101117

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

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

126+
#### For Android
127+
On Android you need [enable developer options](https://developer.android.com/studio/debug/dev-options#enable) and have USB debugging (ADB) enabled.
128+
110129
And that's it! You should now see your Laravel application running as a native app! 🎉

resources/views/docs/mobile/1/getting-started/introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ We've combined the statically compiling PHP as an embeddable C library with the
1212
native APIs of each support platform, unlocking the power and convenience of Laravel for building performant, native
1313
_mobile_ applications using PHP.
1414

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

1717
## Old tools, new tricks
1818

resources/views/docs/mobile/1/getting-started/status.md

+43-6
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,48 @@ order: 099
55

66
## Current Status
77

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

11-
The `beta` phase gives us the opportunity to work with the community to build more features and iron out issues.
12+
Presently, NativePHP for mobile offers the following "native" functionality:
13+
14+
- Vibrate
15+
- Show Toasts
16+
- Show Alerts
17+
- Share
18+
- Camera
19+
- Flashlight
20+
- Biometric ID
21+
- Push Notifications
22+
- Deep Links
23+
- NFC
24+
25+
We're working on adding more and more features, including:
26+
- Secure Storage
27+
- Microphone access
28+
- Location
29+
- Bluetooth
30+
- SMS (Android only)
31+
- File picker
32+
- Video camera access
33+
- Background tasks
34+
- Geofencing
35+
- Native image picker
36+
- Calendar access
37+
- Local notifications, scheduled notifications
38+
- Clipboard API
39+
- Contacts access
40+
- App badges
41+
- OTA Updates
42+
- App review prompt
43+
- Proximity sensor
44+
- Gyroscope
45+
- Accelerometer
46+
- Screen brightness
47+
- Haptic feedback
48+
- Network info access
49+
- Battery status
50+
- CPU information
51+
- Ads
1252

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

resources/views/docs/mobile/1/the-basics/dialogs.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ Dialog::share('Title', 'Description', 'URL');
2626
You may open a native alert dialog by using the `Dialog::alert()` method.
2727

2828
```php
29-
$buttons = [
30-
'Ok',
31-
'Cancel'
32-
];
33-
34-
Dialog::alert('Title', 'Message', $buttons, fn ($selected) => {
35-
echo "You selected {$buttons[$selected]}";
36-
});
29+
Dialog::alert('Title', 'Message');
30+
```
31+
32+
### The Toast Dialog
33+
34+
You may open a native toast dialog by using the `Dialog::toast()` method. There is not a toast dialog on iOS,
35+
on iOS we will simply show an Alert Dialog with just an `OK` button.
36+
37+
```php
38+
Dialog::toast('Message');
3739
```

0 commit comments

Comments
 (0)