1- # PHP GUI with Tcl/Tk
1+ < h1 style = " display : none ; " >< span > PHP GUI</ span ></ h1 >
22
3- A robust cross-platform GUI toolkit for PHP that leverages Tcl/Tk via PHP's FFI extension. Build desktop applications in PHP with an intuitive, object-oriented API.
3+ <div class =" home-hero " >
4+ <span class =" hero-badge " >
5+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 18l6-6l-6-6M8 6l-6 6l6 6"/></svg>
6+ Native UI Framework for PHP
7+ </span >
8+ <h1 >Build Desktop Apps<br >with Pure PHP</h1 >
9+ <p class =" hero-tagline " >A lightweight, highly performant cross-platform GUI toolkit that delegates rendering directly to the OS using PHP's FFI extension. Zero compiled extensions, zero heavy browser engines.<br ><span style =" display :inline-block ; margin-top : 8px ; font-size : 0.85em ; opacity : 0.7 ;" >✨ Inspired by Python's Tkinter, built for modern PHP.</span ></p >
10+ </div >
411
5- ## Features
12+ ## Why PHP GUI?
613
7- - ** Cross-platform** — Works on Linux, Windows, and macOS
8- - ** Zero dependencies** — Tcl/Tk libraries are bundled, no system packages needed
9- - ** Modern PHP** — Requires PHP 8.1+ with FFI extension
10- - ** Simple API** — Clean widget classes that abstract Tcl/Tk complexity
11- - ** Event-driven** — PHP callbacks for interactive widgets
12- - ** 14 Widgets** — Window, Button, Label, Input, Entry, Frame, Canvas, Menu, Menubutton, Checkbutton, Combobox, Message, TopLevel, and Image
14+ <div class =" feature-grid " >
15+ <div class =" feature-card " >
16+ <div class="icon-wrap purple">
17+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/></svg>
18+ </div>
19+ <h4>Cross-Platform</h4>
20+ <p>Works seamlessly on Linux, Windows, and macOS with bundled native libraries.</p>
21+ </div >
22+ <div class =" feature-card " >
23+ <div class="icon-wrap blue">
24+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v17.5"/><path d="m4.5 8 2.97 2.97a2.1 2.1 0 0 0 2.97 0L12 9.41l1.56 1.56a2.1 2.1 0 0 0 2.97 0L19.5 8"/><path d="M4.5 17.5 12 21l7.5-3.5"/><path d="M4.5 12.5 12 16l7.5-3.5"/></svg>
25+ </div>
26+ <h4>Zero Dependencies</h4>
27+ <p>Everything you need is bundled — just install via Composer and start building your GUI natively.</p>
28+ </div >
29+ <div class =" feature-card " >
30+ <div class="icon-wrap amber">
31+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/></svg>
32+ </div>
33+ <h4>Modern PHP</h4>
34+ <p>Built for PHP 8.1+ using the FFI extension for native C library access.</p>
35+ </div >
36+ <div class =" feature-card " >
37+ <div class="icon-wrap green">
38+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15.39 4.39a1 1 0 0 0 1.68-.474a2.5 2.5 0 1 1 3.014 3.015a1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474a2.5 2.5 0 1 0-3.014 3.015a1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474a2.5 2.5 0 1 1-3.014-3.015a1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474a2.5 2.5 0 1 0 3.014-3.015a1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z"/></svg>
39+ </div>
40+ <h4>14 Widgets</h4>
41+ <p>Window, Button, Label, Input, Canvas, Menu, Combobox, and more ready to use.</p>
42+ </div >
43+ <div class =" feature-card " >
44+ <div class="icon-wrap rose">
45+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 4.1L12 6M5.1 8l-2.9-.8M6 12l-1.9 2M7.2 2.2L8 5.1m1.037 4.59a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z"/></svg>
46+ </div>
47+ <h4>Event-Driven</h4>
48+ <p>Attach PHP closures directly to widget events like clicks and key presses.</p>
49+ </div >
50+ <div class =" feature-card " >
51+ <div class="icon-wrap cyan">
52+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4m2-2h-4"/><circle cx="4" cy="20" r="2"/></svg>
53+ </div>
54+ <h4>Simple API</h4>
55+ <p>Clean, intuitive widget classes that abstract away all the low-level system complexity.</p>
56+ </div >
57+ </div >
58+
59+ ## Supported Platforms
60+
61+ <div class =" platform-badges " >
62+ <span class =" platform-badge " >
63+ <?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
64+ <svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none"><path fill="#000000" d="M8.294 1c-.09 0-.184.005-.28.012-2.465.194-1.811 2.804-1.85 3.674-.043.637-.174 1.14-.612 1.762-.516.613-1.24 1.604-1.584 2.637-.162.485-.24.982-.167 1.452a.247.247 0 00-.064.079c-.152.156-.263.35-.387.49-.116.115-.283.155-.465.232-.183.08-.384.157-.504.397a.78.78 0 00-.077.351c0 .116.016.234.032.313.034.233.068.425.023.566-.145.396-.163.668-.062.865.102.195.313.275.549.351.472.117 1.114.079 1.618.35.54.272 1.088.39 1.526.274.307-.067.566-.27.705-.552.342-.001.717-.157 1.318-.194.408-.034.918.155 1.503.116.015.078.037.116.067.194l.001.002c.229.454.65.66 1.1.625.45-.035.928-.313 1.316-.762.368-.446.982-.632 1.387-.877.203-.116.367-.273.379-.497.013-.234-.117-.473-.417-.803v-.056l-.002-.002c-.099-.117-.145-.312-.197-.54-.05-.234-.106-.459-.287-.61h-.001c-.035-.032-.072-.04-.11-.08a.208.208 0 00-.11-.037c.25-.745.153-1.487-.102-2.154-.31-.823-.854-1.54-1.269-2.032-.464-.587-.919-1.142-.91-1.965.016-1.255.138-3.578-2.067-3.581zm.309 1.986h.007c.125 0 .231.036.34.116a.89.89 0 01.256.31c.062.152.093.268.097.423 0-.012.004-.023.004-.035v.061a.05.05 0 01-.003-.012l-.002-.014c-.001.142-.03.282-.087.412a.556.556 0 01-.125.195.415.415 0 00-.051-.024c-.06-.027-.115-.038-.166-.078a.765.765 0 00-.128-.038c.03-.035.085-.078.107-.116a.69.69 0 00.051-.234V3.94a.706.706 0 00-.035-.233c-.027-.079-.06-.117-.107-.195-.05-.038-.098-.077-.156-.077h-.01c-.054 0-.102.018-.152.077a.467.467 0 00-.12.195.688.688 0 00-.052.234v.01c0 .053.004.105.011.156-.112-.039-.255-.078-.354-.117a.954.954 0 01-.01-.117V3.86a1.034 1.034 0 01.087-.448.63.63 0 01.251-.31.575.575 0 01.347-.117zm-1.728.035h.02c.084 0 .158.028.234.078a.806.806 0 01.2.272c.053.116.082.233.09.389v.002a.856.856 0 01-.002.155v.047l-.048.014c-.089.032-.16.079-.23.117a.633.633 0 00.002-.156V3.93c-.007-.078-.023-.117-.047-.194a.358.358 0 00-.097-.156.145.145 0 00-.107-.037h-.012c-.042.003-.076.023-.109.077a.322.322 0 00-.07.157.55.55 0 00-.013.193v.008c.007.08.021.117.047.195a.363.363 0 00.096.157c.006.005.012.01.02.014-.04.033-.068.04-.102.079a.177.177 0 01-.077.04 1.53 1.53 0 01-.16-.235 1.034 1.034 0 01-.09-.389c-.01-.132.005-.264.046-.39a.834.834 0 01.165-.312c.075-.077.152-.116.244-.116zm.799.995c.194 0 .428.038.71.233.17.116.304.157.613.273h.002c.149.079.236.155.279.232v-.076a.333.333 0 01.009.274c-.072.18-.301.375-.62.491v.001c-.156.08-.292.195-.452.272-.161.078-.343.17-.59.155a.664.664 0 01-.262-.039 2.077 2.077 0 01-.188-.115c-.113-.079-.211-.194-.357-.271v-.003h-.003c-.233-.144-.359-.299-.4-.414-.04-.157-.003-.275.113-.35.13-.08.221-.159.282-.197.06-.043.083-.059.102-.076h.001v-.002c.099-.117.255-.274.49-.35.08-.021.171-.038.272-.038h-.001zm1.633 1.25c.21.826.698 2.026 1.012 2.609.167.311.5.967.643 1.764.091-.003.193.01.3.037.376-.975-.319-2.022-.636-2.314-.128-.116-.135-.195-.071-.195.344.312.796.917.96 1.608.075.312.093.644.012.974.039.017.079.035.12.04.601.311.824.547.717.896v-.025c-.035-.002-.07 0-.105 0h-.01c.089-.272-.106-.481-.62-.714-.534-.233-.96-.196-1.033.271-.005.025-.008.039-.01.079-.04.013-.082.03-.123.037-.25.157-.386.39-.462.693-.076.31-.1.674-.12 1.09v.002c-.011.195-.099.489-.186.787-.875.626-2.088.897-3.12.195a1.543 1.543 0 00-.234-.31.846.846 0 00-.16-.195.963.963 0 00.27-.04.359.359 0 00.184-.194c.063-.156 0-.407-.201-.678-.201-.273-.543-.58-1.043-.888-.368-.233-.575-.507-.671-.814-.096-.312-.083-.633-.009-.96.143-.624.51-1.23.743-1.611.063-.038.022.078-.238.568-.23.438-.665 1.456-.07 2.248.022-.578.15-1.146.377-1.678.329-.745 1.016-2.044 1.07-3.073.029.021.127.08.17.118.126.078.22.194.343.271a.694.694 0 00.511.196l.065.003c.24 0 .425-.078.581-.156.17-.078.304-.195.432-.233h.003c.272-.08.487-.235.609-.409zm1.275 5.225c.021.35.2.726.514.803.343.078.837-.194 1.045-.446l.123-.006c.184-.004.337.006.494.156l.002.002c.121.116.178.31.228.511.05.233.09.455.239.622.283.307.376.528.37.665l.003-.004v.01l-.002-.007c-.009.153-.108.231-.29.347-.368.234-1.02.416-1.434.916-.36.43-.8.665-1.188.695-.387.03-.721-.117-.918-.524l-.003-.002c-.122-.233-.07-.597.033-.985.103-.39.25-.784.27-1.107.022-.417.044-.779.114-1.058.07-.271.18-.465.374-.574l.026-.013v-.001zm-6.308.028h.006a.53.53 0 01.091.009c.22.032.412.194.597.438l.53.97.003.003c.141.31.44.62.693.955.253.348.45.66.425.915v.004c-.033.434-.28.67-.656.755-.376.079-.887 0-1.397-.27-.565-.314-1.235-.274-1.667-.352-.215-.039-.355-.117-.421-.233-.064-.117-.066-.352.071-.718v-.002l.002-.002c.068-.195.017-.439-.016-.652-.032-.234-.049-.414.025-.549.093-.194.23-.233.402-.31.172-.08.374-.118.534-.275h.001c.15-.157.26-.351.39-.49.11-.117.222-.196.387-.196zM8.45 5.226c-.254.117-.551.312-.868.312-.316 0-.566-.155-.747-.272-.09-.078-.163-.156-.217-.195-.096-.078-.084-.194-.044-.194.064.01.076.078.117.117.056.038.125.116.21.194.17.116.396.272.68.272.283 0 .615-.156.816-.272.114-.078.26-.194.378-.272.09-.08.087-.156.163-.156.074.01.02.078-.086.194-.13.098-.264.189-.403.273zm-.631-.923V4.29c-.004-.012.007-.024.017-.03.043-.024.105-.015.151.003.037 0 .094.04.088.079-.004.029-.05.038-.079.038-.032 0-.054-.025-.082-.04-.03-.01-.085-.004-.095-.037zm-.322 0c-.011.034-.066.028-.097.038-.027.015-.05.04-.081.04-.03 0-.076-.012-.08-.04-.005-.038.052-.077.088-.077.047-.018.107-.028.151-.003.011.005.021.017.018.029v.012h.001z"/></svg>
65+ Linux
66+ <span class="badge-check"><svg viewBox="0 0 24 24" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg></span>
67+ </span >
68+ <span class =" platform-badge " >
69+ <svg width="18" height="18" viewBox="0 0 448 512" fill="#0078d4"><path d="M0 93.7l183.6-25.3v177.4H0V93.7zm0 324.6l183.6 25.3V268.4H0v149.9zm203.8 28L448 480V268.4H203.8v177.9zm0-380.6v180.1H448V32L203.8 65.7z"/></svg>
70+ Windows
71+ <span class="badge-check"><svg viewBox="0 0 24 24" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg></span>
72+ </span >
73+ <span class =" platform-badge " >
74+ <svg width="18" height="18" viewBox="0 0 384 512" fill="#555555"><path d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"/></svg>
75+ macOS
76+ <span class="badge-check"><svg viewBox="0 0 24 24" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg></span>
77+ </span >
78+ </div >
1379
1480## Quick Start
1581
82+ <div class =" quick-start-section " >
83+
84+ <div class =" section-header " >
85+ <svg viewBox =" 0 0 24 24 " stroke-width =" 2 " stroke-linecap =" round " stroke-linejoin =" round " ><path d =" M12 19h8M4 17l6-6l-6-6 " /></svg >
86+ <h3 >Install via Composer</h3 >
87+ </div >
88+
1689``` bash
1790composer require developersharif/php-gui
1891```
1992
93+ <div class =" section-header " style =" margin-top :20px " >
94+ <svg viewBox =" 0 0 24 24 " stroke-width =" 2 " stroke-linecap =" round " stroke-linejoin =" round " ><path d =" m16 18l6-6l-6-6M8 6l-6 6l6 6 " /></svg >
95+ <h3 >Create your first app</h3 >
96+ </div >
97+
2098``` php
2199<?php
22100require_once __DIR__ . '/vendor/autoload.php';
@@ -43,17 +121,45 @@ $button->pack(['pady' => 10]);
43121$app->run();
44122```
45123
46- ## Supported Platforms
47-
48- | Platform | Status |
49- | ----------| --------|
50- | Linux | ✅ Supported |
51- | Windows | ✅ Supported |
52- | macOS | ✅ Supported |
124+ </div >
53125
54126## Next Steps
55127
56- - [ Installation & Setup] ( getting-started.md ) — Detailed installation guide
57- - [ Architecture] ( architecture.md ) — How the library works under the hood
58- - [ Widgets] ( Window.md ) — Explore all available widgets
59- - [ Full Example] ( example.md ) — Complete application example
128+ <div class =" next-steps " >
129+ <a href =" #/getting-started " class =" next-step-card " >
130+ <div class="card-icon">
131+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10l5 5l5-5"/></svg>
132+ </div>
133+ <div class="card-text">
134+ <strong>Installation & Setup</strong>
135+ <span>Requirements, FFI setup, and your first app</span>
136+ </div>
137+ </a >
138+ <a href =" #/architecture " class =" next-step-card " >
139+ <div class="card-icon">
140+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/></svg>
141+ </div>
142+ <div class="card-text">
143+ <strong>Architecture</strong>
144+ <span>How the FFI bridge works under the hood</span>
145+ </div>
146+ </a >
147+ <a href =" #/Window " class =" next-step-card " >
148+ <div class="card-icon">
149+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/></svg>
150+ </div>
151+ <div class="card-text">
152+ <strong>Widget Reference</strong>
153+ <span>Explore all 14 available widgets</span>
154+ </div>
155+ </a >
156+ <a href =" #/example " class =" next-step-card " >
157+ <div class="card-icon">
158+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09"/><path d="M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z"/><path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05"/></svg>
159+ </div>
160+ <div class="card-text">
161+ <strong>Full Example</strong>
162+ <span>Complete app with menus, dialogs, and events</span>
163+ </div>
164+ </a >
165+ </div >
0 commit comments