Originally published on php-apps.learnio.dev — part of the Using Native PHP course. View this lesson on the original site.

PHP on the device — not on your server

Most PHP developers have only ever run PHP on a server. A user opens a browser, a request travels to your server, PHP runs, HTML comes back. That mental model is so ingrained it is easy to miss what makes NativePHP Mobile genuinely different: your PHP code is bundled inside the app binary and executes on the user's phone.

There is no server. There is no HTTP request leaving the device. Laravel boots locally, handles routes locally, and renders Blade views locally — all inside the app itself.

Why this matters

Understanding the distinction shapes every decision you make in this course.

1. No network required for core functionality

A server-hosted web app stops working when the user goes offline. The request never reaches the server, so nothing can render. With NativePHP Mobile, your core app logic runs entirely on the device. The network only matters when you explicitly choose to call an external API.

This is what "offline-first" actually means in NativePHP terms: it is the default, not a feature you bolt on.

2. No server costs, no infrastructure

You are not provisioning a VPS, paying for uptime, or worrying about autoscaling. The compute is the user's phone. For many app categories — utilities, field tools, personal productivity — this removes an entire infrastructure layer.

3. No round-trip latency

A server-hosted web app has an inherent latency floor: request leaves device, travels to server, PHP runs, response travels back. Even at its fastest, that is tens of milliseconds. On-device execution is in microseconds. UI interactions, local database queries, and business logic all happen without waiting for a network.

4. Your Laravel skills transfer directly

This is not a new architecture you have to learn. The same routes, controllers, Eloquent models, Blade views, and Artisan commands you already know work exactly as expected — they just run locally on the device instead of on a server.

// This is a normal Laravel route — it works identically whether running
// on your development machine via `php artisan serve` or bundled
// inside a NativePHP Mobile app on a phone.
Route::get('/dashboard', [DashboardController::class, 'index']);

The one thing that changes

You lose access to server-side resources that aren't on the device. No direct connection to a remote MySQL database, no server-side queues running in the background (unless you run them on-device), no server-level cron jobs. If you need remote data, you call an external API — the same as any other mobile app.

flowchart LR
    subgraph Server-hosted web app
        Browser -->|HTTP request| Server[PHP on server]
        Server -->|HTML response| Browser
    end
    subgraph NativePHP Mobile app
        WebView -->|local call| PHP[PHP on device]
        PHP -->|rendered view| WebView
    end

Remember

Every time you write a controller, a model, or a Blade view in this course, it runs on the user's phone. Design for that context: lean queries, offline-friendly defaults, and no assumptions about network availability.

From Using Native PHP — Introduction and first screen on mobile