PHP-GTK is a bind of GTK 3 to create desktop applications with PHP
Contributions are always welcome!
See issues for problems and improvements.
PHP-GTK3 work with a middleway of PHP-CPP. In addition to making work faster, syntax and how to program closely resemble PHP, so more people can contribute to the project. Another strong point, perhaps the most important are the updates of Zend.h. In the migration from PHP5 to PHP7 for example, every bind was lost. In that way, there is a nice community working on PHP-CPP to make this updated
You can find a cookbook of codes compiled and organized in http://andor.com.br/php-gtk/cookbook
This is VSCode extension (not official) written by subabrain
PHP-GTK3 includes optional WebView widget support for displaying web content within GTK windows:
- WebKitWebView - Cross-platform web browser widget
- GtkWebView - Convenient alias with GTK-style naming
Platform implementations:
- Linux/macOS: WebKit2GTK
- Windows: Microsoft Edge WebView2
<?php
Gtk::init();
$window = new GtkWindow();
$webView = new GtkWebView(); // or new WebKitWebView()
$webView->load_uri("https://www.example.com");
$scrolled = new GtkScrolledWindow();
$scrolled->add($webView);
$window->add($scrolled);
$window->show_all();
Gtk::main();See WebKit Documentation for full details and examples.
To compile with WebKit support: make WITH_WEBKIT=1
<?php
// Initialize
Gtk::init();
// Callback for when window is closed
function GtkWindowDestroy($widget=NULL, $event=NULL)
{
Gtk::main_quit();
}
// Create a window
$win = new GtkWindow();
$win->set_default_size(300, 200);
// Connect "close" event with callback
$win->connect("destroy", "GtkWindowDestroy");
// Show window
$win->show_all();
// Start
Gtk::main();- @scorninpc - Main dev
- @subabrain - Thank you for your hard work to compile on Windows
- @apss-pohl - A lot fixes and improvements





