Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skoro/php-tkui
Build native desktop applications with PHP only
https://github.com/skoro/php-tkui
desktop ffi gui php php-ffi php-library php74 php8 tcl tcltk
Last synced: 10 days ago
JSON representation
Build native desktop applications with PHP only
- Host: GitHub
- URL: https://github.com/skoro/php-tkui
- Owner: skoro
- Created: 2021-08-22T15:29:45.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-03-16T18:35:45.000Z (8 months ago)
- Last Synced: 2024-09-29T20:01:29.422Z (about 1 month ago)
- Topics: desktop, ffi, gui, php, php-ffi, php-library, php74, php8, tcl, tcltk
- Language: PHP
- Homepage:
- Size: 6.52 MB
- Stars: 490
- Watchers: 18
- Forks: 18
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
- awesome-electron-alternatives - PHP TkUI
README
## php-tkui
`php-tkui` allows you to build desktop ui applications with PHP only. It leverages [FFI](https://www.php.net/manual/en/book.ffi) extension and [Tcl/Tk](https://www.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`:
```sh
sudo apt install tcl tk
```
Next, check `FFI` extension is enabled:
```sh
php --ri ffi
```Clone this repository and try out the demos:
```sh
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
- appearanceCopy 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:
```env
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:
```env
THEME=auto
```### Windows
You need to install one of [Tcl/Tk binary distributions](https://wiki.tcl-lang.org/page/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](tools/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:```sh
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
```