PHP + Rust-Tauri → tiny signed desktop binaries No 100 MB Electron runtime; uses the OS webview (WebView2 / WKWebView / WebKitGTK).
- Small: ship PHP + app in ~15–30 MB, not 100s.
- Fast: native window, hardware-accelerated webview.
- Signed: platform-native code signing & notarization.
- Portable: single EXE/AppImage/.app bundle.
- Secure: no open localhost port required.
- Modern: Beautiful UI with glassmorphism design.
- Tested: Comprehensive test suite with PHPUnit, Vitest, and Playwright.
A complete starter kit + patterns to build desktop apps where UI = HTML/CSS/JS, logic = PHP, and shell/native glue = Rust (Tauri).
This project includes:
-
IPC Mode (implemented) Call PHP scripts from Rust via
tauri::command
, capture output (JSON/HTML), and render in the webview. -
Modern Frontend Beautiful, responsive interface with calculator, file manager, and API testing tools.
-
Comprehensive Backend PHP API endpoints with proper error handling, validation, and security.
-
Full Test Suite Unit tests, integration tests, and end-to-end tests.
-
Production Ready Build scripts, documentation, and deployment guides.
# 1) Clone the repository
git clone <repository-url>
cd php-tauri
# 2) Install dependencies
make install
# or manually:
# npm install && composer install
# 3) Start development server
make dev
# or: npm run tauri:dev
# 4) Run tests
make test
# or: npm test
# 5) Build for production
make build
# or: npm run tauri:build
php-tauri/
├── dist/ # Frontend build output
│ ├── index.html # Main HTML page
│ ├── styles.css # Modern CSS styling
│ └── main.js # JavaScript application
├── php/ # PHP backend
│ ├── index.php # Main PHP page
│ ├── api/ # API endpoints
│ │ ├── hello.php # Hello API
│ │ ├── calculator.php # Calculator API
│ │ └── files.php # File operations API
│ └── src/ # PHP classes
│ ├── App.php # Main app class
│ ├── Calculator.php # Calculator class
│ └── FileManager.php # File manager class
├── src-tauri/ # Rust Tauri application
│ ├── src/
│ │ └── main.rs # Main Rust code
│ ├── Cargo.toml # Rust dependencies
│ ├── tauri.conf.json # Tauri configuration
│ └── bin/php/ # PHP runtime (for bundling)
├── tests/ # Test suites
│ ├── php/ # PHP unit tests
│ ├── frontend/ # Frontend unit tests
│ └── e2e/ # End-to-end tests
└── docs/ # Documentation
├── DEVELOPMENT.md # Development guide
├── BUILD.md # Build guide
└── API.md # API documentation
- Beautiful UI: Glassmorphism design with gradients and animations
- Responsive: Works on desktop, tablet, and mobile
- Interactive: Real-time calculator and file manager
- API Testing: Built-in tools for testing PHP endpoints
- RESTful APIs: JSON-based communication
- Calculator: Mathematical operations (add, subtract, multiply, divide, power, sqrt)
- File Manager: List, read, write, delete files and directories
- Hello API: Testing communication between frontend and backend
- Security: Input validation and path traversal protection
- IPC Communication: Seamless frontend ↔ PHP communication
- Native Performance: Hardware-accelerated webview
- Cross-Platform: Windows, macOS, and Linux support
- Small Size: ~15-30 MB total application size
- Unit Tests: PHP classes and frontend functions
- Integration Tests: API endpoint testing
- E2E Tests: Full application workflow testing
- Coverage: Code coverage reporting
const result = await invoke('php_call', {
script: 'api/hello.php',
payload: { name: 'World' }
});
// Returns: { ok: true, message: "Hello, World from PHP!", ... }
const result = await invoke('php_call', {
script: 'api/calculator.php',
payload: { operation: 'add', a: 5, b: 3 }
});
// Returns: { ok: true, result: 8, ... }
// List files
const files = await invoke('php_call', {
script: 'api/files.php',
payload: { action: 'list', path: '.' }
});
// Read file
const content = await invoke('php_call', {
script: 'api/files.php',
payload: { action: 'read', path: 'test.txt' }
});
# Development
make dev # Start development server
make install # Install all dependencies
make setup # Setup development environment
# Testing
make test # Run all tests
make test-php # Run PHP tests only
make test-frontend # Run frontend tests only
make test-e2e # Run end-to-end tests
# Building
make build # Build for production
make build-windows # Build for Windows
make build-macos # Build for macOS
make build-linux # Build for Linux
# Code Quality
make lint # Run linters
make format # Format code
make lint-fix # Fix linting issues
# Maintenance
make clean # Clean build artifacts
make clean-all # Clean everything
make status # Show project status
- Node.js (v18 or higher)
- PHP (v8.1 or higher)
- Rust (latest stable)
- Tauri CLI (
npm install -g @tauri-apps/cli
)
- Visual Studio Build Tools or Visual Studio Community
- Windows SDK
- WebView2 Runtime (usually pre-installed)
- Xcode Command Line Tools (
xcode-select --install
) - macOS SDK
- WebKit2GTK development packages
- GTK3 development packages
- libssl development packages
Copy env.example
to .env
and customize:
# App Configuration
APP_NAME=php-tauri
APP_VERSION=0.1.0
APP_DEBUG=true
# PHP Configuration
PHP_BIN=php
PHP_MEMORY_LIMIT=128M
# Tauri Configuration
TAURI_DEBUG=true
TAURI_DEV_SERVER_URL=http://localhost:1420
The src-tauri/tauri.conf.json
includes:
- Bundle configuration for all platforms
- Security policies
- Window settings
- Resource bundling
# Run all PHP tests
composer test
# Run with coverage
composer test-coverage
# Run specific test
php tests/php/run_tests.php
# Run unit tests
npm run test:frontend
# Run with watch mode
npx vitest watch
# Run E2E tests
npm run test:e2e
# Run with UI
npm run test:e2e:ui
npm run tauri:dev
npm run tauri:build
# Windows
TAURI_PLATFORM=windows npm run tauri:build
# macOS
TAURI_PLATFORM=macos npm run tauri:build
# Linux
TAURI_PLATFORM=linux npm run tauri:build
- DEVELOPMENT.md - Development workflow and guidelines
- BUILD.md - Build process and distribution
- API.md - Complete API documentation
- CHANGELOG.md - Version history
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Add tests for new functionality
- Run the test suite (
make test
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Q: Why not use Electron? A: Tauri provides smaller bundle sizes (~15-30 MB vs 100+ MB), better performance, and native security.
Q: Can I use Composer packages?
A: Yes! Install packages in php/vendor
and they'll be bundled with the application.
Q: How do I add new API endpoints?
A: Create a new PHP file in php/api/
following the JSON input/output pattern, then call it from the frontend using invoke('php_call', ...)
.
Q: Can I customize the UI?
A: Absolutely! The frontend is in dist/
with modern CSS. You can use any CSS framework or build tool.
Q: How do I add native functionality?
A: Add Rust commands in src-tauri/src/main.rs
and call them from the frontend using invoke()
.
- SQLite integration example
- Auto-updater implementation
- Custom scheme mode template
- Docker development environment
- CI/CD pipeline examples
- More API endpoint examples
- Theme system
- Plugin architecture
This project is licensed under the MIT License - see the LICENSE file for details.
- Tauri for the native wrapper framework
- PHP for the powerful backend runtime
- Vite for the fast build tooling
- Playwright for the excellent testing framework
- All contributors for making this project better
Tagline "Ship PHP like it's 2025: tiny, native, signed, and beautiful."