Skip to content

Commit 0675337

Browse files
simonhampclaude
andcommitted
Mobile v3 docs: simplify versioning guidance around NATIVEPHP_APP_VERSION
- Remove NATIVEPHP_APP_VERSION/_CODE from the pre-install .env block; they default to DEBUG and aren't required up front. - Reframe the configuration page section: lead with what these vars actually are (public version string vs. internal build number, with iOS/Android mappings), note DEBUG is the default, and point at `native:release`. Move the bundled-Laravel extraction mechanics into an aside. - Update the deployment Releasing section to drive readers to `native:release` instead of editing .env by hand, recommend semver for version numbers, and clarify that the build number is auto-incremented and persisted by the command. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bf4dcdb commit 0675337

4 files changed

Lines changed: 38 additions & 27 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,37 @@ So it's not something you want to be changing very often.
3434

3535
## `NATIVEPHP_APP_VERSION`
3636

37-
The `NATIVEPHP_APP_VERSION` environment variable controls your app's versioning behavior.
37+
The `NATIVEPHP_APP_VERSION` environment variable sets your app's **public version string** - what shows up in App Store
38+
and Play Store listings, and on-device under "Settings → Apps" (or equivalent). It maps to `CFBundleShortVersionString`
39+
on iOS and `versionName` on Android.
3840

39-
When your app is compiling, NativePHP first copies the relevant Laravel files into a temporary directory, zips them up,
40-
and embeds the archive into the native application.
41+
Its companion, `NATIVEPHP_APP_VERSION_CODE`, sets the **internal build number** the stores use to distinguish uploads
42+
(`CFBundleVersion` on iOS, `versionCode` on Android). Users don't normally see this one, but the stores require it to
43+
increase with every upload.
4144

42-
When your app boots, it checks the embedded version against the previously installed version to see if it needs to
43-
extract the bundled Laravel application.
45+
`NATIVEPHP_APP_VERSION` defaults to `DEBUG`, which is what you want during development - every boot picks up your
46+
latest code without needing to bump a version number by hand.
4447

45-
If the versions match, the app uses the existing files without re-extracting the archive.
48+
You only need to change this when you're cutting a release build for distribution. Rather than editing your `.env`
49+
manually, use the
50+
[`native:release` command](/docs/mobile/3/getting-started/commands#nativerelease), which bumps the version (and build
51+
number) for you.
4652

47-
To force your application to always install the latest version of your code - especially useful during development -
48-
set this to `DEBUG`:
53+
<aside>
4954

50-
```dotenv
51-
NATIVEPHP_APP_VERSION=DEBUG
52-
```
55+
#### How NativePHP uses these values internally
5356

54-
Note that this will make your application's boot up slightly slower as it must unpack the zip every time it loads.
57+
When your app is compiling, NativePHP copies the relevant Laravel files into a temporary directory, zips them up, and
58+
embeds the archive into the native application.
5559

56-
But this ensures that you can iterate quickly during development, while providing a faster, more stable experience for
57-
end users once an app is published.
60+
On boot, the app compares the embedded `NATIVEPHP_APP_VERSION` and `NATIVEPHP_APP_VERSION_CODE` against the values from
61+
the previously installed version. If they match, it skips extracting the archive and reuses the already-unpacked files.
62+
63+
This means the first boot after an install or update unpacks the bundled Laravel app, and every subsequent boot is
64+
significantly faster. It's also why `DEBUG` makes development boots a bit slower - the archive is always extracted so
65+
you see your latest changes.
66+
67+
</aside>
5868

5969
## Persistent Runtime
6070

resources/views/docs/mobile/3/getting-started/deployment.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,32 @@ If you want more hands-on support, we happily work with our [Partners](/partners
5858

5959
## Releasing
6060

61-
To prepare your app for release, you should set the version number to a new version number that you have not used
62-
before and increment the build number:
61+
To prepare your app for release, bump the version number using the
62+
[`native:release` command](/docs/mobile/3/getting-started/commands#nativerelease):
6363

64-
```dotenv
65-
NATIVEPHP_APP_VERSION=1.2.3
66-
NATIVEPHP_APP_VERSION_CODE=48
64+
```shell
65+
php artisan native:release patch
6766
```
6867

68+
You can pass `patch`, `minor`, or `major` depending on the type of release you're cutting. This updates
69+
`NATIVEPHP_APP_VERSION` in your `.env` and increments the build number for you.
70+
6971
### Versioning
7072

71-
You have complete freedom in how you version your applications. You may use semantic versioning, codenames,
72-
date-based versions, or any scheme that works for your project, team or business.
73+
App version numbers should follow [semantic versioning](https://semver.org) (e.g. `1.2.3`). The `native:release` command
74+
relies on this format to determine how to bump your version.
7375

7476
Remember that your app versions are usually public-facing (e.g. in store listings and on-device settings and update
7577
screens) and can be useful for customers to reference if they need to contact you for help and support.
7678

77-
The build number is managed via the `NATIVEPHP_APP_VERSION` key in your `.env`.
79+
The app version is managed via the `NATIVEPHP_APP_VERSION` key in your `.env`.
7880

7981
### Build numbers
8082

8183
Both the Google Play Store and Apple App Store require your app's build number to increase for each release you submit.
8284

83-
The build number is managed via the `NATIVEPHP_APP_VERSION_CODE` key in your `.env`.
85+
The build number is managed via the `NATIVEPHP_APP_VERSION_CODE` key in your `.env`. You don't need to manage this
86+
yourself — running `native:release` automatically increments the build number and persists it back to your `.env`.
8487

8588
### Run a `release` build
8689

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ NativePHP does not work in WSL (Windows Subsystem for Linux). You must install a
3535

3636
```dotenv
3737
NATIVEPHP_APP_ID=com.yourcompany.yourapp
38-
NATIVEPHP_APP_VERSION="DEBUG"
39-
NATIVEPHP_APP_VERSION_CODE="1"
4038
```
4139

42-
Find out more about these options in
40+
Find out more about this option in
4341
[Configuration](/docs/getting-started/configuration#codenativephp-app-idcode).
4442

4543
<aside>

0 commit comments

Comments
 (0)