Skip to content

Latest commit

 

History

History
85 lines (63 loc) · 2.27 KB

README.md

File metadata and controls

85 lines (63 loc) · 2.27 KB

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.2
  • 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.

macOS

You need to install one of Tcl/Tk binary distributions same as for Windows. The easiest way is to install it using brew:

brew install tcl-tk

Then you need to set paths to dylibs in .env file:

DARWIN_LIB_TCL=/usr/local/Cellar/tcl-tk/[installed_version]/lib/libtcl8.6.dylib
DARWIN_LIB_TK=/usr/local/Cellar/tcl-tk/[installed_version]/lib/libtk8.6.dylib