-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
V1 docs #111
Changes from 5 commits
cf223d5
902415a
cda319e
d595a8b
b820ceb
543cf67
44747bc
d9b550b
1c0518a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I will merge the |
||
|
||
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). | ||
simonhamp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -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 | ||
|
||
|
@@ -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 | ||
|
||
|
@@ -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: | ||
|
@@ -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! 🎉 |
There was a problem hiding this comment.
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.