Skip to content

Repository files navigation

Tauri-PHP

Latest Version on Packagist Total Downloads License

Transform your Laravel applications into beautiful, fast, and secure cross-platform desktop and mobile applications using Tauri and FrankenPHP.

✨ Features

  • πŸš€ One-Command Initialization - Get started with a single Artisan command
  • πŸ–₯️ Desktop Support - Build for Windows, macOS, and Linux from a single codebase
  • πŸ“± Mobile Support - Build native Android and iOS applications
  • πŸ“¦ Embedded PHP - No PHP installation required on user devices thanks to FrankenPHP
  • πŸ”’ Code Protection - Built-in PHP code obfuscation support
  • ⚑ Hot Reload - Fast development with hot reload support
  • 🎨 Framework Agnostic - Works with Vue, React, Svelte, or vanilla JavaScript
  • 🐳 Docker Support - Cross-compile for different platforms using Docker
  • πŸ”§ Easy Configuration - Simple .env.tauri configuration file

πŸ“‹ Prerequisites

Before using Tauri-PHP, ensure you have the following installed:

  • PHP 8.0 or higher (8.0, 8.1, 8.2, or 8.3)
  • Laravel 9.x, 10.x, 11.x, or 12.x
  • Node.js 18+ and npm
  • Rust and Cargo - Install from rustup.rs
  • Docker (optional, for cross-platform builds)

πŸ“¦ Installation

Install the package via Composer:

composer require mucan54/tauri-php

Publish the configuration file (optional):

php artisan vendor:publish --tag=tauri-php-config

πŸš€ Quick Start

1. Initialize Tauri in Your Laravel Project

php artisan tauri:init

This command will:

  • Create .env.tauri configuration file
  • Set up the Tauri project structure
  • Install necessary dependencies
  • Generate Rust backend code
  • Create the desktop frontend

2. Start Development Server

php artisan tauri:dev

This opens your Laravel app in a native desktop window with hot reload support.

3. Build for Production

# Build for current platform
php artisan tauri:build

# Build for specific platform
php artisan tauri:build --platform=windows-x64

# Build with code obfuscation
php artisan tauri:build --obfuscate

Your distributable application will be in src-tauri/target/release/bundle/.

πŸ“– Documentation

For detailed documentation, visit our documentation directory:

🎯 Available Commands

Desktop Commands

Command Description
php artisan tauri:init Initialize Tauri in your Laravel project
php artisan tauri:dev Start development server with hot reload
php artisan tauri:build Build the application for production
php artisan tauri:package Create distribution packages
php artisan tauri:clean Clean build artifacts and temporary files

Mobile Commands

Command Description
php artisan tauri:mobile-init {platform} Initialize mobile platform (android/ios/both)
php artisan tauri:mobile-dev {platform} Run app on mobile device/emulator
php artisan tauri:build --platform=android Build Android application (APK/AAB)
php artisan tauri:build --platform=ios Build iOS application

βš™οΈ Configuration

The package uses a .env.tauri file for configuration. Here are the key settings:

# Application Info
TAURI_APP_NAME="My Desktop App"
TAURI_APP_IDENTIFIER=com.example.myapp
TAURI_APP_VERSION=0.1.0

# Window Settings
TAURI_WINDOW_TITLE="My Desktop App"
TAURI_WINDOW_WIDTH=1200
TAURI_WINDOW_HEIGHT=800

# Development Server
TAURI_DEV_HOST=127.0.0.1
TAURI_DEV_PORT=8080

# FrankenPHP Settings
TAURI_FRANKENPHP_VERSION=latest
TAURI_PHP_VERSION=8.3
TAURI_PHP_EXTENSIONS=opcache,pdo_sqlite,mbstring,openssl,tokenizer,xml,ctype,json,bcmath,fileinfo

# Build Settings
TAURI_BUILD_DEBUG=false
TAURI_OBFUSCATE_CODE=false

πŸ—οΈ How It Works

  1. FrankenPHP Embedding: Your Laravel application is embedded with a standalone FrankenPHP binary
  2. Tauri Wrapper: A lightweight Rust/Tauri application wraps your Laravel app in a native window
  3. No External Dependencies: Users don't need PHP, a web server, or any dependencies installed
  4. Native Performance: Leverages native webviews for optimal performance and small bundle sizes

🌍 Supported Platforms

Desktop Platforms

Platform Target Triple Status
Linux x64 x86_64-unknown-linux-gnu βœ… Supported
Linux ARM64 aarch64-unknown-linux-gnu βœ… Supported
macOS x64 x86_64-apple-darwin βœ… Supported
macOS ARM64 (M1/M2) aarch64-apple-darwin βœ… Supported
Windows x64 x86_64-pc-windows-msvc βœ… Supported

Mobile Platforms

Platform Target Triple Status
Android (ARM64) aarch64-linux-android βœ… Supported
Android (ARMv7) armv7-linux-androideabi βœ… Supported
Android (x86_64) x86_64-linux-android βœ… Supported
iOS (ARM64) aarch64-apple-ios βœ… Supported
iOS Simulator aarch64-apple-ios-sim βœ… Supported

πŸ”’ Code Obfuscation

Protect your source code when distributing:

php artisan tauri:build --obfuscate

This uses YakPro-Po by default to obfuscate your PHP code before embedding.

🐳 Cross-Platform Building

Build for multiple platforms using Docker:

# Build for specific platform
php artisan tauri:build --platform=windows-x64

# Build for multiple platforms
./docker-build.sh "linux-x64,windows-x64,macos-arm64"

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

The MIT License (MIT). Please see License File for more information.

πŸ™ Credits

  • Built on top of Tauri - The Rust-powered desktop framework
  • Uses FrankenPHP - The modern PHP app server
  • Inspired by the Laravel community

πŸ“§ Support

🌟 Show Your Support

If this package helped you, please give it a ⭐️ on GitHub!


Made with ❀️ for the Laravel community

About

No description, website, or topics provided.

Resources

Stars

14 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages