NativePHP: Build Native Desktop and Mobile Apps with PHP and Laravel

Admin

8 October, 2025

In a world dominated by JavaScript, Swift, Kotlin, React Native, and Flutter, most PHP developers face an uncomfortable choice: learn an entirely new language and toolchain just to ship a native app, or stay in their comfort zone and skip the native experience entirely.

NativePHP eliminates that tradeoff. It lets you build fully native desktop and mobile applications using the PHP and Laravel codebase you already know — no new language, no heavy framework migration, and no compromise on native functionality. If you’ve been looking for a cost-effective path to cross-platform app development without abandoning your existing skill set, this guide is for you.


What Is NativePHP?

NativePHP is a modern framework that bridges the gap between server-side PHP and native application development. It does three things that were previously impossible in the PHP ecosystem:

Native system access via clean PHP classes. NativePHP exposes the operating system’s native capabilities — windows, menus, file dialogs, push notifications, biometric authentication, camera access, and more — through simple, expressive PHP and Laravel facades. There is no JavaScript glue code, no bridge layer you have to manage manually.

Transparent build tool integration. Under the hood, NativePHP uses either Electron (the same engine behind VS Code, Slack, and Figma) or Tauri as its application shell. Electron offers broad compatibility and an enormous ecosystem. Tauri produces significantly smaller and more memory-efficient binaries — often 10x smaller than Electron equivalents — making it the better choice for performance-sensitive applications or users on lower-end hardware.

A bundled PHP runtime. NativePHP ships a static PHP interpreter directly inside the compiled application. End users never need PHP installed on their machine. The app simply works, like any other native binary they download from the internet.

The result: you keep writing PHP, Blade templates, Livewire components, or Inertia.js — and you get a real native application that runs on Windows, macOS, Linux, iOS, and Android.


Who Should Use NativePHP?

NativePHP is the right tool in several practical situations:

Web developers expanding to desktop. If you have an existing Laravel SaaS or internal tool and want to offer a desktop client without hiring a separate team, NativePHP lets you reuse 80–100% of your existing codebase.

Teams evaluating cross-platform app development costs. Native app development typically costs $80,000–$200,000 per platform when built with Swift or Kotlin from scratch. Cross-platform frameworks like React Native or Flutter reduce this, but still require learning new paradigms. NativePHP reduces both cost and learning curve by leveraging skills you already have.

PHP freelancers and agencies expanding their service offerings. Adding native desktop and mobile app development to your portfolio opens entirely new revenue streams — without onboarding engineers who specialize in different stacks.

Startups building offline-first tools. Because PHP runs locally on the device with NativePHP, your app functions completely without an internet connection. No backend to maintain for basic functionality, no API rate limits, no latency.


NativePHP vs. React Native vs. Flutter: An Honest Comparison

Before diving into the tutorial, it is worth understanding where NativePHP fits in the broader cross-platform development landscape.

FeatureNativePHPReact NativeFlutter
Language requiredPHP (existing skill)JavaScript / TypeScriptDart (new language)
Learning curve for PHP devsVery lowHighHigh
Desktop app supportYes (Electron / Tauri)LimitedYes (experimental)
Mobile app supportYes (iOS / Android)YesYes
Offline-first capabilityExcellentGoodGood
Bundle size (desktop)Medium (Electron) / Small (Tauri)N/AMedium
Reuse existing Laravel codeYes, fullyNoNo
Native OS API accessYesYesYes
App store distributionYesYesYes
Typical dev cost (MVP)Low (no new stack)$30,000–$80,000$25,000–$70,000

For PHP development teams, NativePHP offers a unique advantage no other framework matches: zero context switching. You stay in the same codebase, the same IDE, the same deployment mental model.


Requirements

Desktop (Windows, macOS, Linux)

Before starting, ensure your development environment has the following installed:

  • PHP 8.1 or higher
  • Composer (latest stable version)
  • Node.js 18+ and npm
  • Laravel 10 or higher (recommended)
  • Git
  • Electron or Tauri dependency (installed automatically by NativePHP)

Mobile (iOS and Android)

  • All desktop requirements above, plus:
  • macOS with Xcode 14+ (required for iOS builds — Apple’s toolchain only runs on macOS)
  • Android Studio with the latest SDK (for Android builds — works on Windows, macOS, and Linux)
  • Apple Developer Program account ($99/year) for distributing on the App Store
  • Google Play Console account ($25 one-time fee) for distributing on Google Play

Desktop Tutorial: Step-by-Step

Step 1 — Create or use an existing Laravel project

Open your terminal and create a new Laravel project, or navigate to an existing one:

bash
composer create-project laravel/laravel my-native-app
cd my-native-app
php artisan serve

Visit http://localhost:8000 to confirm Laravel is running. Any existing Laravel application — including ones with Livewire, Inertia.js, or custom Blade templates — works as a starting point.

Step 2 — Install NativePHP for desktop via Electron

Add the NativePHP package to your project:

bash
composer require nativephp/electron

Run the installer:

bash
php artisan native:install

This command does three things automatically: prepares the Electron boilerplate, creates the .nativephp/ configuration directory for your app, and installs the required Node.js dependencies. You do not need to configure anything manually.

Step 3 — Launch the application

bash
php artisan native:serve

Laravel starts in the background and a native desktop window opens immediately, rendering your application. You are no longer in a browser — this is a real desktop app with access to native OS features.

Step 4 — Configure your application window

Edit app/Providers/NativeAppServiceProvider.php to control how your window behaves:

php
use Native\Laravel\Facades\Window;

public function boot()
{
    Window::open()
        ->title('My Native App')
        ->width(1280)
        ->height(800)
        ->minWidth(800)
        ->minHeight(600)
        ->resizable()
        ->centerOnScreen()
        ->alwaysOnTop(false);
}

You can open multiple windows from the same application — useful for settings panels, document editors, or dashboard sub-views.

Step 5 — Add a native menu bar

NativePHP lets you create a menu bar identical to those in any native macOS, Windows, or Linux application:

php
use Native\Laravel\Facades\Menu;
use Native\Laravel\Menu\MenuItem;

public function boot()
{
    $menu = Menu::new()
        ->appMenu()
        ->submenu('File', [
            MenuItem::label('New Document')->event('file.new'),
            MenuItem::label('Open...')->event('file.open'),
            MenuItem::label('Save')->event('file.save'),
            MenuItem::separator(),
            MenuItem::label('Quit')->quit(),
        ])
        ->submenu('Help', [
            MenuItem::label('Documentation')->url('https://nativephp.com/docs'),
            MenuItem::label('Report a Bug')->event('help.bug'),
        ]);

    $menu->register();
}

Menu items fire Laravel events, which you can listen for with standard Event listeners anywhere in your application.

Step 6 — Native system notifications

Send a native OS notification — the kind that appears in the system notification center on macOS, Windows Action Center, or Linux desktop notifications — with a single call:

php
use Native\Laravel\Facades\Notification;

Notification::new()
    ->title('Export Complete')
    ->message('Your report has been exported to the Documents folder.')
    ->image(public_path('icon.png'))
    ->show();

Step 7 — Access the filesystem with native dialogs

NativePHP lets you open native file picker and save dialogs:

php
use Native\Laravel\Facades\Dialog;

// Open file picker
$path = Dialog::new()
    ->title('Select a file')
    ->filter('CSV Files', ['csv'])
    ->open();

// Save file dialog
$savePath = Dialog::new()
    ->title('Save Report')
    ->defaultPath(storage_path('exports/report.csv'))
    ->save();

This gives your application the same UX as native file management that users expect from professional software.

Step 8 — System tray integration

For applications that run in the background, NativePHP supports system tray icons:

php
use Native\Laravel\Facades\MenuBar;

MenuBar::create()
    ->icon(public_path('tray-icon.png'))
    ->withContextMenu(
        Menu::new()
            ->submenu('Actions', [
                MenuItem::label('Open Dashboard')->event('app.open'),
                MenuItem::label('Sync Now')->event('app.sync'),
                MenuItem::separator(),
                MenuItem::label('Quit')->quit(),
            ])
    );

This pattern is particularly valuable for background sync tools, monitoring dashboards, and productivity utilities.

Step 9 — Build and distribute your desktop app

When development is complete, package your application into a distributable executable:

bash
php artisan native:build

This generates a platform-specific binary: a .exe installer for Windows, a .dmg for macOS, or an AppImage/.deb for Linux. The PHP runtime is bundled inside. End users install it exactly like any other application — no PHP, no Composer, no terminal required.

Distribution cost benchmarks: Distributing a desktop application built with NativePHP costs nothing for self-distribution. For Microsoft Store distribution, the registration fee is $19 (one-time). For Mac App Store distribution, the Apple Developer Program costs $99/year.


Mobile Tutorial: iOS and Android

NativePHP’s mobile support allows you to take the same Laravel codebase and run it as a native iOS or Android application. PHP executes directly on the device inside a native wrapper — a Swift project on iOS, a Kotlin project on Android. This means your app runs fully offline with no server required.

Step 1 — Install NativePHP Mobile

bash
composer require nativephp/mobile
php artisan native:mobile:install

This creates the project structure and installs the required native project templates.

Step 2 — Initialize the mobile project

bash
php artisan native:mobile:init

This generates two native wrapper projects inside a mobile/ directory: a Swift/Xcode project for iOS and a Kotlin/Android Studio project for Android. Both come pre-configured to embed your Laravel application with a bundled PHP runtime.

Step 3 — Run on emulator or physical device

iOS (requires macOS + Xcode):

bash
php artisan native:mobile:serve ios

The Xcode Simulator launches with your application running inside a native iOS shell.

Android:

bash
php artisan native:mobile:serve android

Android Studio opens the emulator, or if you have a physical device connected via USB with developer mode enabled, the app deploys directly to your phone.

Step 4 — Access native mobile APIs

NativePHP exposes mobile hardware APIs through the same facade pattern you use everywhere in Laravel.

Camera access:

php
use Native\Laravel\Facades\Camera;

$photo = Camera::capture();
$photo->save(storage_path('app/public/photo.jpg'));

Local push notifications:

php
use Native\Laravel\Facades\Notification;

Notification::new()
    ->title('Reminder')
    ->message('Your scheduled sync is ready.')
    ->badge(3)
    ->show();

Biometric authentication (Face ID, Touch ID, fingerprint):

php
use Native\Laravel\Facades\Biometrics;

if (Biometrics::check()) {
    // User authenticated — proceed
    return redirect()->route('dashboard');
} else {
    // Authentication failed or not available
    return redirect()->route('login');
}

Geolocation:

php
use Native\Laravel\Facades\GPS;

$location = GPS::current();
// Returns latitude, longitude, accuracy

Device storage and local database:

Because PHP runs locally on the device, you can use SQLite with Laravel’s standard Eloquent ORM as your local database. This makes building offline-first mobile apps with complex data models straightforward — no custom synchronization logic required for local persistence.

Step 5 — Package and submit to app stores

iOS:

bash
php artisan native:mobile:build ios

Generates an .ipa file ready for submission to TestFlight for beta testing, or directly to the App Store via Xcode or Transporter.

Android:

bash
php artisan native:mobile:build android

Generates an .apk (for direct installation) or .aab (Android App Bundle, required for Google Play submissions).

App store submission cost summary:

  • Apple App Store: $99/year (Apple Developer Program)
  • Google Play Store: $25 one-time registration fee
  • Microsoft Store: $19 one-time registration fee

Real-World Use Cases: What Should You Build with NativePHP?

Understanding where NativePHP genuinely excels helps you prioritize the right projects for it.

Internal business tools. Companies frequently need desktop tools for data entry, invoice generation, inventory management, or report generation — tools used only inside the organization and not worth the cost of full native development. NativePHP turns an existing Laravel admin panel into a distributable desktop application in hours.

Offline-first field applications. Inspectors, field technicians, and medical professionals often work in environments without reliable internet. A NativePHP mobile app can store data locally using SQLite and sync it to a server when connectivity is restored, all within a familiar Laravel architecture.

SaaS companion apps. If you already have a Laravel-based SaaS product, NativePHP lets you ship a desktop companion app that integrates with your existing API, authentication system, and business logic — sharing models, validation rules, and service classes with zero duplication.

Developer tools and CLI GUIs. PHP developers maintaining complex tooling sometimes want a GUI for tasks that are inconvenient in the terminal. NativePHP provides a native interface layer on top of any existing Artisan command or service.


Performance Considerations and Limitations

NativePHP is powerful, but it is important to use it with clear expectations.

Desktop app size. Electron-based NativePHP apps bundle a Chromium browser and a Node.js runtime alongside your PHP binary. Final app sizes typically range from 150MB to 300MB. For comparison, Slack’s Electron app is approximately 300MB. If binary size is critical, the Tauri backend produces significantly smaller outputs — often 15–30MB. Evaluate which backend fits your distribution requirements.

Startup time. Electron apps take slightly longer to cold-start than apps built with native Swift or Kotlin. For most business applications this is acceptable. For apps where sub-second launch time is a hard requirement, evaluate Tauri or consider whether a native approach is warranted.

CPU and memory. Electron apps consume more RAM than lean native equivalents. On modern hardware with 8GB+ RAM this is rarely a problem. On older or constrained hardware, test thoroughly before shipping.

Mobile maturity. NativePHP’s mobile support is newer than its desktop support and continues to evolve. Review the official documentation at nativephp.com for the current status of mobile API coverage before committing to a production mobile project.


NativePHP vs. Hiring Native Developers: A Cost Comparison

For businesses and PHP development agencies evaluating whether NativePHP makes financial sense:

ApproachInitial Development CostTime to MarketTeam Required
NativePHP (existing PHP team)Low — no new hires2–4x fasterExisting PHP devs
React Native$30,000–$80,000 (new team)MediumJavaScript devs
Flutter$25,000–$70,000 (new team)MediumDart devs
Native Swift + Kotlin$80,000–$200,000+SlowestTwo separate teams

For teams already proficient in PHP and Laravel, NativePHP reduces mobile app development cost to the cost of developer hours on familiar tooling — no recruitment, no onboarding, no parallel codebases.


Deployment and App Distribution Strategy

Getting your NativePHP app into users’ hands requires understanding the distribution options available on each platform.

Self-distribution (all platforms). You can host your compiled binary on your own website and distribute it directly. This avoids app store fees and review processes but requires you to handle code signing (required on macOS and increasingly expected on Windows) and update delivery yourself.

Windows code signing. Without a code signing certificate, Windows Defender SmartScreen will flag your installer as potentially dangerous. EV (Extended Validation) certificates for Windows code signing cost approximately $200–$500/year.

macOS notarization. Apple requires notarization for apps distributed outside the Mac App Store. This is a free process through Xcode, but requires an Apple Developer Program membership ($99/year). Without notarization, Gatekeeper blocks installation on macOS 10.15+.

Auto-update delivery. NativePHP integrates with Electron’s built-in auto-updater. Host your update files on any static server (S3, Cloudflare R2, your own server) and your application can update silently in the background — identical to how professional desktop software handles updates.


Frequently Asked Questions

Can I use NativePHP with an existing Laravel application? Yes. NativePHP installs as a Composer package into any Laravel project. You can immediately expose your existing routes, views, and business logic in a native window. Most existing Laravel applications require zero code changes to run as a desktop application.

Does NativePHP support Laravel Livewire and Inertia.js? Yes. Because NativePHP renders your application through an embedded browser engine, any frontend stack that runs in a browser — Livewire, Inertia with Vue or React, Alpine.js, Filament — works without modification.

How does NativePHP handle database access in a desktop app? NativePHP supports SQLite out of the box for local data storage, which is the standard choice for desktop applications that need a database without a server. You can also connect to a remote MySQL or PostgreSQL database if your application requires it.

Is NativePHP production-ready? NativePHP’s desktop support (via Electron and Tauri) is stable and used in production applications. The mobile support is newer and still maturing. Review the official changelog and issue tracker at github.com/nativephp/laravel before committing to a production mobile release.

How do NativePHP apps compare to PWAs (Progressive Web Apps)? PWAs run in the browser and have limited access to native OS APIs. NativePHP apps have full native access: system tray, native menus, file system dialogs, biometric authentication, camera, GPS, and more. For any use case requiring deep OS integration, NativePHP provides a fundamentally more capable platform than a PWA.

Can I monetize a NativePHP app through app stores? Yes. Apps built with NativePHP can be submitted to the Mac App Store, Microsoft Store, Google Play Store, and Apple App Store through the standard submission processes. Monetization models — one-time purchase, subscription (via StoreKit on iOS, Google Play Billing on Android), or in-app purchase — are all supported through the native store APIs.

What is the PHP license situation for distributed apps? PHP is open-source software licensed under the PHP License, which permits free use, modification, and redistribution in commercial products. There are no licensing fees for bundling PHP inside a NativePHP application.


Conclusion

NativePHP represents something genuinely new in the PHP ecosystem: a viable, production-capable path to cross-platform app development that does not require abandoning the tools and knowledge you have built over years of PHP and Laravel work.

The framework is not trying to compete with Swift or Kotlin for performance-critical consumer apps. It is solving a different and equally real problem: giving PHP teams the ability to ship native desktop and mobile software with the same codebase, the same deployment confidence, and a fraction of the cost of building those same apps from scratch in a new language.

If you have a Laravel application and you have ever thought “this would work even better as a desktop app” — the barrier to trying it is now just a single composer require.

Leave a Comment