Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

developersharif/php-gui

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.