Installation
Get NativePHP Desktop up and running in your Laravel application in just a few steps.Prerequisites
Before installing NativePHP Desktop, ensure you have:PHP 8.3+
NativePHP requires PHP version 8.3 or higher
Laravel 10+
Compatible with Laravel 10.x, 11.x, and 12.x
Composer
For managing PHP dependencies
ext-zip
PHP zip extension must be enabled
Step 1: Install via Composer
Install the NativePHP Desktop package using Composer:- The
nativephp/desktoppackage - Required dependencies including
nativephp/php-binfor embedded PHP runtime - Laravel package tools and utilities
The installation may take a few moments as it downloads the embedded PHP binaries for desktop distribution.
Step 2: Publish Configuration
Publish the NativePHP configuration file and service provider:config/nativephp.php- Main configuration fileapp/Providers/NativeAppServiceProvider.php- Your application’s native service provider
Configuration File
The
config/nativephp.php file contains settings for your application metadata, updater configuration, and build options.Step 3: Verify Installation
Verify that NativePHP Desktop is correctly installed by checking the available Artisan commands:native:* commands available:
Package Overview
Automatic Registration
NativePHP Desktop automatically registers these facades for use in your application:Available Facades
NativePHP provides the following facades out of the box:ChildProcess- Spawn and manage child processesClipboard- Access system clipboardContextMenu- Create context menusDock- Control macOS dock (macOS only)GlobalShortcut- Register global keyboard shortcutsMenu- Create application menusMenuBar- Create menu bar applicationsNotification- Show native notificationsPowerMonitor- Monitor system power eventsProcess- Manage application processesQueueWorker- Background queue workersScreen- Get display informationSettings- Persistent application settingsShell- Execute shell commandsSystem- Access system informationWindow- Manage application windowsUpdater- Handle application updates
Development vs Production
NativePHP Desktop works differently in development and production:Development Mode
In development (APP_DEBUG=true), NativePHP:
- Uses your local PHP installation
- Creates a SQLite database at
database/nativephp.sqlite - Automatically runs migrations
- Shows developer tools in windows
- Provides detailed error messages
Production Mode
In production (after building), NativePHP:- Bundles an embedded PHP runtime
- Uses an isolated storage directory
- Hides developer tools
- Cleans up sensitive environment variables
- Optimizes for performance
You can develop and test your application locally before building it for distribution. See the Quick Start guide to run your first desktop app.
Next Steps
Now that NativePHP Desktop is installed:Configuration
Configure your application settings and metadata
Quick Start
Build your first desktop application
Troubleshooting
ext-zip Not Installed
If you get an error about theext-zip extension: