Skip to main content
NativePHP Mobile is in active development. Some features may change as the project evolves.

Welcome to NativePHP Mobile

NativePHP Mobile enables you to build native iOS and Android applications using PHP and Laravel. Write your mobile apps with the same tools and framework you already know, without needing to learn Swift, Kotlin, or React Native.

How it works

NativePHP Mobile embeds a PHP runtime directly inside your mobile app. Your Laravel application runs natively on the device, rendering views through a WebView while accessing native device features through a simple PHP API.
use Native\Mobile\Facades\Camera;
use Native\Mobile\Facades\Geolocation;
use Native\Mobile\Facades\Haptics;

// Take a photo
$photo = Camera::getPhoto();

// Get current location
$location = Geolocation::getCurrentPosition(fineAccuracy: true);

// Provide haptic feedback
Haptics::vibrate();

Key features

Native device access

Access camera, geolocation, haptics, device info, secure storage, and more through simple PHP facades.

Hot reload development

Develop with live reload on physical devices and emulators using php artisan native:run --watch.

Cross-platform support

Build for both iOS and Android from a single PHP codebase. Platform-specific code when needed.

Laravel integration

Use Blade templates, Eloquent, routing, validation, and all your favorite Laravel features.

Plugin system

Extend functionality with plugins that add native iOS and Android capabilities to your PHP app.

Production ready

Build release packages for the App Store and Google Play with code signing and optimization.

What you can build

NativePHP Mobile is perfect for:
  • Business applications - Internal tools, dashboards, and admin panels
  • E-commerce apps - Shopping experiences with native features
  • Content apps - News, blogs, and media consumption
  • Productivity tools - Task managers, note-taking, and utilities
  • Location-based apps - Services that leverage GPS and maps
  • Camera-enabled apps - Photo capture, QR scanning, and image processing

Platform detection with Blade directives

NativePHP provides convenient Blade directives to conditionally render content:
@mobile
    <p>This content only appears in the mobile app</p>
@endmobile

@web
    <p>This content only appears in the web browser</p>
@endweb

@ios
    <p>iOS-specific content</p>
@endios

@android
    <p>Android-specific content</p>
@endangroid

Requirements

  • PHP 8.3 or higher
  • Laravel 10.x, 11.x, or 12.x
  • Composer
  • macOS (iOS development requires Apple hardware)
  • Xcode 14 or later
  • iOS Simulator or a physical iOS device
  • Apple Developer account (for physical devices and App Store)
  • Windows, macOS, or Linux
  • Android SDK (installed via Android Studio)
  • Java Development Kit (JDK) 17 or later
  • Android Emulator or a physical Android device

Next steps

Installation

Install NativePHP Mobile and set up your development environment

Quickstart

Build your first mobile app in under 5 minutes

Native features

Explore device features like camera, geolocation, and haptics

CLI reference

Learn about available commands and development tools

Example: Simple mobile app

Here’s a taste of what building with NativePHP Mobile looks like:
// routes/web.php
Route::get('/', function () {
    return view('welcome');
});

Route::post('/capture', function () {
    $photo = Camera::getPhoto();
    
    // Save the photo
    Storage::put('photos/' . $photo['name'], base64_decode($photo['base64']));
    
    Haptics::vibrate();
    
    return back()->with('success', 'Photo captured!');
});
{{-- resources/views/welcome.blade.php --}}
<!DOCTYPE html>
<html>
<head>
    <title>My NativePHP App</title>
    @vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body>
    <h1>Welcome to NativePHP Mobile</h1>
    
    @mobile
        <form action="/capture" method="POST">
            @csrf
            <button type="submit">Take Photo</button>
        </form>
    @endmobile
    
    @web
        <p>Please open this app on a mobile device</p>
    @endweb
</body>
</html>

Community and support

  • Documentation - You’re reading it! Explore the sidebar for detailed guides
  • GitHub - nativephp/mobile for issues and contributions
  • Discord - Join the NativePHP community for discussions and help
Ready to build your first mobile app? Continue to the installation guide.

Build docs developers (and LLMs) love