Download the PHP package developersharif/php-gui without Composer
On this page you can find all versions of the php package developersharif/php-gui. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download developersharif/php-gui
More information about developersharif/php-gui
Files in developersharif/php-gui
Package php-gui
Short Description Cross-platform GUI development package for PHP using Tcl/Tk
License
Informations about the package php-gui
https://github.com/user-attachments/assets/788e6124-5fe0-49c1-a222-c0bb432f509e
PHP GUI gives you two ways to build desktop applications from the same PHP codebase:
| Mode | Best for | Engine |
|---|---|---|
| Native Widgets | System-style UIs — forms, dialogs, tools | Tcl/Tk via FFI |
| WebView | Modern UIs with HTML/CSS/JS (like Tauri, but PHP) | WebKitGTK / WKWebView / WebView2 |
Both modes work on Linux, macOS, and Windows with zero system dependencies on Linux — libraries are bundled.
Requirements
| Minimum | |
|---|---|
| PHP | 8.1+ |
| Extension | ext-ffi enabled (ffi.enable=true in php.ini) |
| Composer | any recent version |
Linux — no extra packages needed (Tcl/Tk is bundled).
macOS — no extra packages needed.
Windows — no extra packages needed.
Enable FFI if not already on:
Installation
That's it. No system Tcl/Tk install, no native build steps.
Quick Start
Create app.php:
A native window opens immediately. No compilation, no manifest files, no packaging step.
Native Widgets
Native widgets render as real OS controls using Tcl/Tk under the hood. The PHP API is simple and consistent across all platforms.
Available Widgets
| Widget | Description | Docs |
|---|---|---|
Window |
Main application window | → |
TopLevel |
Secondary window / dialog launcher | → |
Label |
Static or dynamic text display | → |
Button |
Clickable button with callback | → |
Input / Entry |
Single-line text field | → |
Checkbutton |
Checkbox with on/off state | → |
Combobox |
Dropdown selection | → |
Frame |
Container for grouping widgets | → |
Menu |
Menu bar with submenus and commands | → |
Menubutton |
Standalone menu button | → |
Canvas |
Drawing surface for shapes and images | → |
Message |
Multi-line text display | → |
Image |
Display images inside windows | → |
Layout
Every widget supports three layout managers. Mix them freely within a window.
Styling
Pass Tcl/Tk options directly in the constructor array or update them at runtime:
Common options: bg, fg, font, relief (flat raised sunken groove ridge), padx, pady, width, height, cursor.
Dialogs
TopLevel provides native system dialogs — no extra packages:
Menus
Complete Example
WebView Mode
WebView lets you build the UI with HTML, CSS, and JavaScript while keeping all your business logic in PHP. Think of it as Tauri for PHP.
PHP ↔ JavaScript Bridge
JS → PHP — call PHP functions from the browser:
PHP → JS — push events to the frontend:
Serving a Frontend App
Load a built frontend (React, Vue, Svelte, Vanilla — anything) directly from disk. No HTTP server, no open ports, no firewall prompts:
| Platform | Mechanism | URL |
|---|---|---|
| Linux | phpgui:// custom URI scheme |
phpgui://app/index.html |
| Windows | WebView2 virtual hostname | https://phpgui.localhost/ |
| macOS | loadFileURL:allowingReadAccess: |
file:///path/to/dist/ |
Vite Dev + Production in One Line
serveVite() auto-detects whether the dev server is running:
Recommended vite.config.js for cross-platform builds:
Bypass CORS — Transparent Fetch Proxy
Cross-origin API calls fail from phpgui:// / file:// origins. One call routes all fetch() requests through PHP:
Full Vite App Example
See the full WebView documentation →
Platform Support
| Platform | Native Widgets | WebView | Notes |
|---|---|---|---|
| Linux (x86-64) | ✅ | ✅ | Tcl/Tk bundled. WebView needs libwebkit2gtk-4.1-dev |
| Linux (ARM64) | ✅ | — | Tcl/Tk bundled |
| macOS | ✅ | ✅ | No extra dependencies |
| Windows | ✅ | ✅ | No extra dependencies |
Linux WebView dependency:
Documentation
| Guide | |
|---|---|
| Getting Started | FFI setup, first app, layout, events |
| Architecture | How the FFI bridge and event loop work |
| WebView | Full WebView API reference |
Widget reference: Message
License
MIT
All versions of php-gui with dependencies
ext-ffi Version *