# NativePHP

Add separate PHP desktop and mobile applications to your workspace.


Use NativePHP for desktop or mobile applications built on Laravel. Give each application its own Laravel root rather than combining your API, desktop, and mobile runtimes.

## Add to your workspace

Check the [Node.js and Nx requirements](/docs/workflows/requirements#platform-plugins) for this plugin before installing.

Install `@megamono/nx-phpnative` as a development dependency using your workspace's package manager. Merge this entry into the existing `plugins` list in `nx.json`:

```json
{
  "plugins": [
    "@megamono/nx-phpnative"
  ]
}
```

Run `npm exec -- nx show projects` to find your project, then `npm exec -- nx show project <project>` to see its tasks. Replace `<project>` with the name from the list.

## Prepare a native application

Install `@megamono/nx-laravel` as well as this plugin, and register Laravel first in the plugins list. Select a PHP runtime compatible with the NativePHP version you use.

```sh
npm exec -- nx generate @megamono/nx-phpnative:application --name=desktop --platform=desktop --appId=com.example.desktop --dry-run
```

Review the preview and repeat without `--dry-run`. Run the generated setup target, configure the Laravel environment, then install Composer and frontend dependencies as described in the [Laravel guide](/docs/platforms/laravel).

## Run on your platform

Native tooling installation is explicit: run the app’s `native-install` target when ready. Desktop apps expose `native-run` and `native-build`; mobile apps expose `native-run-ios` and `native-run-android`. Inspect the project for the complete target list.

Install the required operating-system SDKs and simulators, configure signing, and test on real devices before publishing. See [NativePHP application options](/docs/generators/nx-phpnative-application).
