You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: resources/views/docs/mobile/1/getting-started/configuration.md
+46-1
Original file line number
Diff line number
Diff line change
@@ -3,4 +3,49 @@ title: Configuration
3
3
order: 200
4
4
---
5
5
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.
Copy file name to clipboardExpand all lines: resources/views/docs/mobile/1/getting-started/development.md
+32-1
Original file line number
Diff line number
Diff line change
@@ -3,5 +3,36 @@ title: Development
3
3
order: 300
4
4
---
5
5
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.
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
29
38
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!
32
48
33
49
## Private package
34
50
35
51
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.
37
53
38
54
Before you begin, you will need to purchase a license.
39
55
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
44
60
"repositories": [
45
61
{
46
62
"type": "composer",
47
-
"url": "https://nativephp-ios.composer.sh"
63
+
"url": "https://nativephp.composer.sh"
48
64
}
49
65
],
50
66
```
51
67
52
-
## Install NativePHP for iOS
68
+
## Install NativePHP for mobile
53
69
54
70
```shell
55
-
composer require nativephp/ios
71
+
composer require nativephp/mobile
56
72
```
57
-
This package contains all the libraries, classes, commands, and interfaces that your application will need to work with
58
-
iOS.
59
73
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.
61
75
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.
63
78
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
+
```
65
86
66
87
## Run the NativePHP installer
67
88
@@ -70,11 +91,7 @@ php artisan native:install
70
91
```
71
92
72
93
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.
78
95
79
96
## Start your app
80
97
@@ -87,16 +104,15 @@ Once you're ready:
87
104
php artisan native:run
88
105
```
89
106
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.
91
108
92
109
### Running on a real device
93
110
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
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).
98
114
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
100
116
Finder. Click on model name at the top until the UDID appears, then right-click on it to copy it.
101
117
102
118
Then you can simply run, replacing `{UDID}` with your device's UDID:
@@ -107,4 +123,7 @@ php artisan native:run {UDID}
107
123
108
124
Alternatively, you may open the `ios/NativePHP.xcodeproj` file in Xcode and run builds using Xcode's UI.
109
125
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
+
110
129
And that's it! You should now see your Laravel application running as a native app! 🎉
0 commit comments