https://github.com/developersharif/php-gui
Cross-platform GUI development package for PHP using Tcl/Tk
https://github.com/developersharif/php-gui
Last synced: 2 months ago
JSON representation
Cross-platform GUI development package for PHP using Tcl/Tk
- Host: GitHub
- URL: https://github.com/developersharif/php-gui
- Owner: developersharif
- License: mit
- Created: 2025-04-09T11:03:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-29T14:46:06.000Z (12 months ago)
- Last Synced: 2025-12-12T15:55:54.329Z (6 months ago)
- Language: Tcl
- Size: 15.7 MB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP GUI with Tcl/Tk
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.
https://github.com/user-attachments/assets/788e6124-5fe0-49c1-a222-c0bb432f509e
## Requirements
- **PHP 8.1+** with the **[FFI](https://www.php.net/manual/en/book.ffi.php)** extension enabled.
- **[Composer](https://getcomposer.org/)** for dependency management.
## Installation
**Install dependencies:**
```bash
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**: ☑️
## Architecture Diagram

## Documentation
For detailed documentation on each widget and component, please refer to the documentation files in the [docs](./docs) folder:
- [Window](./docs/Window.md)
- [TopLevel](./docs/TopLevel.md)
- [Message](./docs/Message.md)
- [Menubutton](./docs/Menubutton.md)
- [Menu](./docs/Menu.md)
- [Frame](./docs/Frame.md)
- [Entry](./docs/Entry.md)
- [Combobox](./docs/Combobox.md)
- [Canvas](./docs/Canvas.md)
- [Checkbutton](./docs/Checkbutton.md)
- [Label](./docs/Label.md)
- [Input](./docs/Input.md)
- [Button](./docs/Button.md)
## Usage Example
Below is a sample usage example to get you started:
```php
'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](LICENSE).