As a long-time PHP developer, I never thought I’d say this — but I just built a desktop app using only PHP. No Electron, no Java, no Python. Just PHP… and it works. The secret sauce? NativePHP.
Why Even Build a Desktop App in PHP?
If you’re like me, you’ve probably been asked at some point:
“Can we make this tool run as a desktop app for non-technical staff?”
And usually, the answer was:
- “Let’s use Electron” (but oh god, I don’t love JavaScript that much).
- “Maybe Python?” (but… I don’t want to switch stacks for one feature).
Then I stumbled upon NativePHP — a framework that lets you build real desktop apps using the language I’ve spent years mastering.
What Exactly Is NativePHP?
NativePHP is a new framework that lets PHP developers create cross-platform desktop applications using the Laravel framework or even plain PHP. Under the hood, it uses Tauri, a secure and fast toolkit for building desktop apps.
You write your app in PHP, use Laravel routes, views, and components — and NativePHP wraps it into a native window. No need to learn a whole new stack.
It feels like Laravel. Because it is.
How It Works
Here’s a super simplified version of how NativePHP apps work:
- Your Laravel (or plain PHP) app acts as the backend logic
- The frontend can be plain HTML, Blade templates, or even native UI components provided by NativePHP
- Tauri wraps everything into a real desktop app (like an
.exeor.appfile)
You write the logic, NativePHP takes care of the window, menu, file dialogs, and even notifications.
First App in 10 Minutes
Here’s what I did to get a basic desktop app up and running:
- Installed the CLI:
composer global require nativephp - Created a new app:
nativephp new my-first-desktop-app
cd my-first-desktop-app
php artisan native:serve - Opened
routes/web.phpand added this:
use Native\Laravel\Facades\Notification;Route::get(‘/notify’, function () { Notification::title(‘Hello from NativePHP’) ->message(‘It actually works!’) ->show();return redirect('/');}); - Created a button on the homepage that links to
/notify.
Boom. A native alert pops up like magic.
Real Use Cases
To be honest, not every app needs to be a desktop app. But NativePHP makes it surprisingly practical to build:
- Internal tools for non-technical staff
- Small business utilities
- Offline-first data entry apps
- Dashboard apps with native notifications
- Personal tools you just want to “run like an app”
Pros & Cons (So Far)
What I love:
- I can stay in the PHP/Laravel ecosystem
- The setup is pretty smooth if you’re already familiar with Laravel
- Native notifications, menus, file dialogs — all accessible via PHP
- No Electron bloat
What I’m watching:
- Still a young project — docs are improving, but not perfect
- UI is mostly HTML-based (unless you want to dive into Tauri APIs manually)
- You’ll need Node.js and Rust installed (Tauri dependency)
But honestly? The tradeoff is worth it. This is one of the most exciting things to happen to PHP in years.
Final Thoughts
If you’ve ever wanted to build a desktop app but didn’t want to switch languages or dive into Electron hell, give NativePHP a shot. It’s still early, but it’s already incredibly usable — and fun.
I never thought PHP would land on my desktop. But here we are.
Check it out at https://nativephp.com
And if you build something cool — hit me up!