Skip to content

chore: add webview demo app and dev architecture docs#19

Merged
developersharif merged 1 commit intomainfrom
web-widget
Apr 4, 2026
Merged

chore: add webview demo app and dev architecture docs#19
developersharif merged 1 commit intomainfrom
web-widget

Conversation

@developersharif
Copy link
Copy Markdown
Owner

No description provided.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@developersharif developersharif merged commit e5043e7 into main Apr 4, 2026
6 checks passed
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request establishes the core architecture and implementation roadmap for a PHP GUI framework, introducing a streamlined V1 blueprint that emphasizes a zero-dependency model with both Tcl/Tk and WebView engines. The changes include detailed design documents, a technical plan for a WebView helper process, and a functional todo application for testing. Review feedback suggests improving the robustness of the test application by handling potential file read failures and utilizing strict comparisons, as well as clarifying the status of a superseded architecture document that contains rejected design patterns.

Comment on lines +28 to +29
$html = file_get_contents(__DIR__ . '/index.html');
$webview->setHtml($html);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

file_get_contents returns false on failure. Since setHtml expects a string, passing false will trigger a TypeError in PHP 8.0+. It is safer to handle the potential failure explicitly.

$html = file_get_contents(__DIR__ . '/index.html') ?: throw new \RuntimeException("index.html not found");
$webview->setHtml($html);

$data = json_decode($args, true);
$id = $data[0] ?? '';
foreach ($todos as &$todo) {
if ($todo['id'] == $id) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using strict comparison (===) is preferred here to ensure type safety, especially since $id is derived from JSON input and $todo['id'] is a string.

        if ($todo['id'] === $id) {

$webview->bind('deleteTodo', function(string $reqId, string $args) use ($webview, &$todos) {
$data = json_decode($args, true);
$id = $data[0] ?? '';
$todos = array_filter($todos, fn($todo) => $todo['id'] != $id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Strict comparison (!==) should be used when filtering the array to maintain consistency and type safety.

    $todos = array_filter($todos, fn($todo) => $todo['id'] !== $id);

@@ -0,0 +1,410 @@
# PHP GUI Framework — Architecture Plan
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The filename coreframeowrkv1.md contains a typo ('frameowrk'). Furthermore, this document appears to describe an architecture (proposing DI containers and plugin managers) that was explicitly rejected in FRAMEWORK_ARCHITECTURE_REVIEW.md and omitted from the final blueprint in CORE_FRAMEWORK_ARCHITECTURE.md. To avoid confusion for future contributors, this file should be renamed (e.g., ARCHIVED_ORIGINAL_PLAN.md) and updated with a note explaining its status as a superseded proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant