developersharif/php-gui 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

developersharif/php-gui

最新稳定版本:v1.2

Composer 安装命令:

composer require developersharif/php-gui

包简介

Cross-platform GUI development package for PHP using Tcl/Tk

README 文档

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

  • PHP 8.1+ with the FFI extension enabled.
  • Composer for dependency management.

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

System 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.

统计信息

  • 总下载量: 47
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 0
  • 开发语言: Tcl

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-04-09