developersharif / php-gui
Cross-platform GUI development package for PHP using Tcl/Tk
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Tcl
Requires
- php: >=8.1
- ext-ffi: *
README
A robust cross-platform GUI toolkit for PHP that leverages Tcl/Tk via PHP's FFI extension. This library offers a professional API for building graphical interfaces in PHP, seamlessly abstracting Tcl/Tk complexities behind intuitive widget classes.
demo-video.mp4
Requirements
Installation
Install dependencies:
composer require developersharif/php-gui
Project Structure
- src/: Core PHP source code
- Widget/: Contains widget classes (Window, Button, Label, etc.).
- ProcessTCL.php: Wraps the Tcl interpreter via FFI.
- Application.php: Manages the event loop and application lifecycle.
Supported Platforms
- Linux: ☑️
- Windows: ☑️
- macOS: Coming soon.
Architecture Diagram
Documentation
For detailed documentation on each widget and component, please refer to the documentation files in the docs folder:
Usage Example
Below is a sample usage example to get you started:
<?php require_once __DIR__ . '/vendor/autoload.php'; use PhpGui\Application; use PhpGui\Widget\Window; use PhpGui\Widget\Label; use PhpGui\Widget\Button; use PhpGui\Widget\Input; $app = new Application(); $window = new Window(['title' => 'Example', 'width' => 500, 'height' => 300]); $label = new Label($window->getId(), ['text' => 'Hello, PHP GUI!']); $label->pack(['pady' => 20]); $button = new Button($window->getId(), [ 'text' => 'Click Me', 'command' => function() use ($label) { $label->setText('Button clicked!'); } ]); $button->pack(['pady' => 10]); $input = new Input($window->getId(), ['text' => 'Type here...']); $input->pack(['pady' => 10]); $app->run();
License
This project is licensed under the MIT License.