From c6b453f4c9a9ac0ca7b3835d085563991afccd52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BF=AB=E4=B9=90=E4=B8=A4=E5=B0=8F=E6=97=B6?=
<1164601554@qq.com>
Date: Tue, 27 Aug 2024 15:15:04 +0800
Subject: [PATCH] add php
---
server/docs/2.5/README.md | 664 +++++++++++++++++++++++++++++++++++++
server/docs/2.5/index.html | 1 +
2 files changed, 665 insertions(+)
diff --git a/server/docs/2.5/README.md b/server/docs/2.5/README.md
index 9d91626..05e8e70 100644
--- a/server/docs/2.5/README.md
+++ b/server/docs/2.5/README.md
@@ -198,6 +198,14 @@ exe.linkLibrary(zig_webui.artifact("webui"));
2. Bring in the static [WebUI static release](https://github.com/webui-dev/webui/releases) or [build action](https://github.com/webui-dev/webui/actions?query=branch%3Amain) file for your platform and place it in your project's root directory.
+
+#### ** PHP **
+
+
+```sh
+composer require kingbes/webui
+```
+
#### **Other...**
@@ -349,6 +357,20 @@ pub fn main() {
}
```
[More Rust Examples](https://github.com/webui-dev/rust-webui/tree/main/examples).
+
+#### **PHP **
+
+```php
+require "./vendor/autoload.php";
+
+use Kingbes\Webui;
+
+$Webui = new Webui;
+$win = $Webui->newWindow();
+$Webui->show($win, " Hello World from PHP! ");
+$Webui->wait();
+```
+
#### **Other...**
**Pascal**
```sh
@@ -459,6 +481,17 @@ var new_window = webui.newWindow();
let win = webui::Window::new();
```
+#### **PHP**
+
+```php
+use Kingbes\Webui;
+
+$Webui = new Webui;
+$win = $Webui->newWindow();
+// Later
+$Webui->show($win, "index.html");
+```
+
#### **Other...**
**Pascal**
@@ -591,6 +624,23 @@ window.show("index.html")
// In development...
```
+#### **PHP**
+
+```php
+use Kingbes\Webui;
+
+$Webui = new Webui;
+
+/*
+* @param window The window number
+*/
+$win = 1;
+$Webui->newWindowId($win);
+
+// Later
+$Webui->show($win,"index.html");
+```
+
#### **Other...**
**Pascal**
@@ -717,6 +767,20 @@ window.show("index.html")
// In development...
```
+#### **PHP**
+
+```php
+use Kingbes\Webui;
+
+$Webui = new Webui;
+
+$win = $Webui->getNewWindowId();
+
+// Later
+$Webui->newWindowId($win);
+$Webui->show($win,"index.html");
+```
+
#### **Other...**
**Pascal**
@@ -923,6 +987,24 @@ win.bind("MyID2", |_: webui::Event| -> String {
});
```
+#### **PHP**
+
+```php
+use Kingbes\Webui;
+use Kingbes\JavaScript;
+
+$Webui = new Webui;
+$win = $Webui->newWindow();
+
+// bind
+$bind = $Webui->bind(
+ $win,
+ "hello",
+ function ($event, JavaScript $js) {
+ //
+});
+```
+
#### **Other...**
**Pascal**
@@ -1173,6 +1255,31 @@ fn event_handler(e: webui::Event) {
win.bind("", event_handler);
```
+#### **PHP**
+
+```php
+$Webui->bind(
+ $win,
+ "hello",
+ function ($event, JavaScript $js) {
+
+ /*$event = object(FFI\CData:struct webui_event_t*)#6 (1) {
+ [0]=>
+ object(FFI\CData:struct webui_event_t)#9 (8) {
+ ["window"]=> int // The window object number
+ ["event_type"]=> int // Event type
+ ["element"]=> string // HTML element ID
+ ["event_number"]=> int // Internal
+ ["bind_id"]=> int // Bind ID
+ ["client_id"]=> int // Client's unique ID
+ ["connection_id"]=> int // Client's connection ID
+ ["cookies"]=> string // Client's full cookies
+ }
+ } */
+
+});
+```
+
#### **Other...**
**Pascal**
@@ -1348,6 +1455,37 @@ let bestBrowser = window.getBestBrowser()
```rust
// In development...
+```
+
+#### **PHP**
+
+```php
+use Kingbes\Webui;
+
+$Webui = new Webui;
+
+/*
+ NoBrowser, // 0. No web browser
+ AnyBrowser, // 1. Default recommended web browser
+ Chrome, // 2. Google Chrome
+ Firefox, // 3. Mozilla Firefox
+ Edge, // 4. Microsoft Edge
+ Safari, // 5. Apple Safari
+ Chromium, // 6. The Chromium Project
+ Opera, // 7. Opera Browser
+ Brave, // 8. The Brave Browser
+ Vivaldi, // 9. The Vivaldi Browser
+ Epic, // 10. The Epic Browser
+ Yandex, // 11. The Yandex Browser
+ ChromiumBased, // 12. Any Chromium based browser
+ WebView, // 13. WebView (Non-web-browser)
+*/
+
+/*
+* @param window The window number
+*/
+$Webui->getBestBrowser($win);
+
```
#### **Other...**
@@ -1525,6 +1663,22 @@ win.show("file.html");
win.show("https://mydomain.com");
```
+#### **PHP**
+
+```php
+use Kingbes\Webui;
+
+$Webui = new Webui;
+$win = $Webui->newWindow();
+
+
+/*
+* @param window The window number
+* @param content The HTML, URL, Or a local file
+*/
+$Webui->show($win, "index.html");
+```
+
#### **Other...**
**Pascal**
@@ -1695,6 +1849,37 @@ const successed = myWindow.showBrowser("
+