• Stars
    star
    464
  • Rank 94,450 (Top 2 %)
  • Language
    PHP
  • Created over 3 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Build native desktop applications with PHP only

php-tkui

php-tkui allows you to build desktop ui applications with PHP only. It leverages FFI extension and Tcl/Tk for that, thus you don't need to compile or install any external extensions.

Requirements

  • PHP >= 8.1
  • ffi extension must be enabled
  • Tcl/Tk >= 8.6

Getting started

Make sure that Tcl/Tk is installed in your OS. For Debian/Ubuntu based distros you may install it with apt:

sudo apt install tcl tk

Next, check FFI extension is enabled:

php --ri ffi

Clone this repository and try out the demos:

git clone https://github.com/skoro/php-tkui.git php-tkui
cd php-tkui
composer install
php demos/buttons.php

Configuration

You may enable some application features like:

  • debug mode
  • appearance

Copy the provided .env.example into .env and customize the options.

Debug mode allows you to find out which commands are executed by Tcl engine. To enable the debug mode set:

DEBUG=true
DEBUG_LOG=php://stdout

All the debug messages will go to the console. You may specify a file name instead of console.

To change the application appearance comment out THEME option and set one of: clam, alt, default, classic. Additional themes for Windows: winnative, xpnative, vista. By default, auto is used, setting a theme depending on OS:

THEME=auto

Windows

You need to install one of Tcl/Tk binary distributions and set path to dlls in .env file like this:

WINDOWS_LIB_TCL=c:\\tcltk\\bin\\tcl86t.dll
WINDOWS_LIB_TK=c:\\tcltk\\bin\\tk86t.dll

Also, you can build your own Tcl/Tk distribution, take a look at BUILD-WIN.md doc how to do that.