gabrielrcouto / php-gui Goto Github PK
View Code? Open in Web Editor NEWExtensionless PHP Graphic User Interface library
Extensionless PHP Graphic User Interface library
In PSR-0 a fully-qualified namespace and class must have the following structure:
\<Vendor Name>\(<Namespace>\)*<Class Name>
And the current structure of php-gui don't have a vendor name. Why?
We need to change the Application Title, Icon...
The idea is to put the Application into the objects array, will be the index 0.
I'm currently using PHP-GUI wrote a program, how to compile it into exe?
composer require gabrielrcouto/php-gui
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Using version ^0.1.0 for gabrielrcouto/php-gui
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for gabrielrcouto/php-gui dev-master -> satisfiable by gabrielrcouto/php-gui[dev-master].
- Can only install one of: gabrielrcouto/php-gui[v0.1.0, dev-master].
- Installation request for gabrielrcouto/php-gui ^0.1.0 -> satisfiable by gabrielrcouto/php-gui[v0.1.0].
Installation failed, reverting ./composer.json to its original content.
Hello! I rebuild the lazarus and I added the TOpenDialog.
RegisterClass(TOpenDialog);
And when I "Execute", its not working
I'm calling like this:
$this->call('execute', []);
Where is my mistake?
Sorry for my English!
See: vendor/gabrielrcouto/php-gui/examples/03-window/example.php 【PHP with version 7.2.0 NTS】
$button->on('click', function () use ($button, $application) {
$window = ($application->getWindow());
//var_dump($application->getWindow());
if ($window->getHeight() == 600) {
$window->setHeight(300);
} else {
$window->setHeight(600);
}
$button->setCounter($button->getCounter() + 1);
$button->setValue('Your window was resized ' . $button->getCounter() . ' time(s), click to resize again!');
});
found the "onClick" event was emitted only once, and then i have a debug for "var_dump($application->getWindow())" , also output nothing on terminal. TKS.
example:
interface MessageInterface
{
}
interface CommandInterface extends MessageInterface
{
}
interface EventInterface extends MessageInterface
{
}
And also change all method signature adding the type hinting.
sometimes the $application->process->stdout wait for a some data length to write, and with it, the Receiver::onData() can't to process the message because sometimes the message came that way:
{"id": 6, "result": 2}Get: {"callback":{},"id":7,"method":"setObjectEventListener","params":[2,"onclick"]}
As you can see, after the end of the 1st JSON is the letter "G", and it's beeing sent by the lazaruz binary.
So, with the following condition the PHP goes inside the if statement, but in the next instruction the json can not be decoded.
if ($data[0] === '{' && $data[strlen($data) - 1] === '}') {
$message = json_decode($data);
// ...
I can see 2 way to solve it;
And as the process->stdout works that way, I mean that sometimes the Receiver::onData() can receive 2 or more jsons, and it MUST be splitted. and it is not being done.
Hey,
I did some extensive testing with the library today and found that most applications crash on startup. I've tried all the examples available in the repository and only 02 and 06 could be started successfully.
Running phpunit gave me this warning:
1) Test\Components\ObjectTest::testMagicCall
Trying to configure method "__call" which cannot be configured because it does not exist, has not been specified, is final, or is static
All other tests passed without any warnings.
I tested with both the current development branch and the 1.0 release on Mac OS X El Capitan 10.11.4. I'm using PHP 7.0.7.
We can use a better IPC Protocol, it need to be:
Suggestions:
A great comparison: https://capnproto.org/news/2014-06-17-capnproto-flatbuffers-sbe.html
We need a more secure way to build the binaries, as commented on #125
OS X 10.11 natively comes with PHP 5.5, having 5.6 as a requirement makes apps built in this not easily redistributable, as they require the end user to have a non-system version of PHP.
My end goal for app building would be to have these usable by people who don't need to know or care about PHP, at all. They should have no reason to even know my app is developed in PHP.
When we will get a component property ($button->value), it will be need to:
hello,
I get this with PHP 7.2.6 x86
C:\Users\Momchil\Desktop\PHP-GUI>php examples\01-basic\example.php
PHP Fatal error: Uncaught LogicException: Windows isn't supported due to the blocking nature of STDIN/STDOUT/STDERR pipes. in C:\Users\Momchil\Desktop\PHP-GUI\react\ChildProcess\Process.php:52
Stack trace:
#0 C:\Users\Momchil\Desktop\PHP-GUI\src\Application.php(286): React\ChildProcess\Process->__construct('.\phpgui-x86_64...', 'C:\Users\Momchi...')
#1 C:\Users\Momchil\Desktop\PHP-GUI\examples\01-basic\example.php(82): Gui\Application->run()
#2 {main}
thrown in C:\Users\Momchil\Desktop\PHP-GUI\react\ChildProcess\Process.php on line 52
Running all latest sources from GitHub
So, Windows is no more ?
Is there something like a keydown on some object that isn't inputText? I couldn't find something like that :/
I used
$closeButton->on('click', function() use ($application) { exit(); });
to close the window, the php process is exit, but the window is still exists.
and a little time later, some error happend.
And hope have some feature to use xml file to create ui.
Which there was an easy way to get a PHP+SQLITE stack up and running on iOS ;)
Then one could deploy the same app to clients as to the server (distributed software system)
Is it possible with PHP-GUI? How can I access such data like screen size, mouse position?
In Windows the Lazarus doesn't execute the actions.
Compile the Lazarus for Windows
不好意思,英文太差,我还是用中文吧,在windows10系统上运行例子的时候,canvas的例子会卡死出现问题
=> Sent: {"id":34,"method":"setObjectProperty","params":[10,"top",136],"callback":{}}
=> Sent: {"id":35,"method":"setObjectProperty","params":[10,"caption","\u64ad\u653e"],"callback":{}}
=> Sent: {"id":36,"method":"setObjectProperty","params":[10,"width",50],"callback":{}}
=> Sent: {"id":37,"method":"setObjectEventListener","params":[8,"onclick"],"callback":{}}
=> Sent: {"id":38,"method":"setObjectEventListener","params":[10,"onclick"],"callback":{}}
JSON ERROR: TCarbonClipboard.Create Error: PasteboardCreate primary selection failed with result -4960
TCarbonClipboard.Create Error: PasteboardCreate secondary selection failed with result -4960
TCarbonClipboard.Create Error: PasteboardCreate clipboard failed with re{"id": 5, "result": 1}
Fatal error: Uncaught Gui\Exception\ComponentException: [0]: JSON ERROR: TCarbonClipboard.Create Error: PasteboardCreate primary selection failed with result -4960
TCarbonClipboard.Create Error: PasteboardCreate secondary selection failed with result -4960
TCarbonClipboard.Create Error: PasteboardCreate clipboard failed with re{"id": 5, "result": 1}
i run my program many time, but today occur this error, this error occur first time. who know this error?
we can see a example in the next line after: https://github.com/gabrielrcouto/php-gui/blob/gh-pages/src/src/assets/markdown/0.1/Gui-Application.md#arguments-1
Hello guys,
I've been using Ubuntu for a while and I tried to run the code shown in README.md file but my screen just freeze when I run it.
<?php
require 'vendor/autoload.php';
use Gui\Application;
use Gui\Components\Button;
$application = new Application();
$application->on('start', function() use ($application) {
$button = (new Button())
->setLeft(40)
->setTop(100)
->setWidth(200)
->setValue('Look, I\'m a button!');
$button->on('click', function() use ($button) {
$button->setValue('Look, I\'m a clicked button!');
});
});
$application->run();
My O.S : Ubuntu 14.04
any ideas ?
Hi! I guess ProgressBar
support will be great.
I've tried to create \Gui\Components\ProgressBar
, with $lazarusClass = 'TProgressBar';
, but it doesn't work at all. I'm just not familiar with lazarus :-)
We can create, we need to be able to destroy! 👍
Object
is no longer a valid class name since php 7.2 php/php-src@8e10c9d
PHP Fatal error: Cannot use Gui\Components\Object as Object because 'Object' is a special class name in /tmp/vendor/gabrielrcouto/php-gui/src/Application.php on line 5
PHP Stack trace:
PHP 1. {main}() /tmp/myapp.php:0
PHP 2. spl_autoload_call() /tmp/myapp.php:7
PHP 3. Composer\Autoload\ClassLoader->loadClass() /tmp/myapp.php:7
PHP 4. Composer\Autoload\includeFile() /tmp/vendor/composer/ClassLoader.php:322
Fatal error: Cannot use Gui\Components\Object as Object because 'Object' is a special class name in /tmp/vendor/gabrielrcouto/php-gui/src/Application.php on line 5
Call Stack:
0.0002 450856 1. {main}() /tmp/myapp.php:0
0.0013 530784 2. spl_autoload_call() /tmp/myapp.php:7
0.0013 530864 3. Composer\Autoload\ClassLoader->loadClass() /tmp/myapp.php:7
0.0014 530992 4. Composer\Autoload\includeFile() /tmp/vendor/composer/ClassLoader.php:322
Sometimes we will need to call a object method, like ScrollBy(DeltaX, DeltaY) for scrolling a text field.
Curious as to how php-gui compares. Both are targeted at builing cross platform apps, but surely php-gui is more a niche with it's own api (millions of devs already know HTML/CSS than a custom api to build a GUI).
When would you choose php-gui over something like Electron?
Running examples I realize that the window php-gui opens are hidden behind other applications, I guess the issue is because of Autofocus not being used yet.
In example "05-canvas" is possible to see what happens when multiple IPC messages are sent. After a while, the messages are ignored by Lazarus, the GUI still works, but don't receive anymore new IPC messages (still sends).
Can be:
Package kherge/version is abandoned, you should avoid using it. No replacement was suggested.
Package herrera-io/json is abandoned, you should avoid using it. Use kherge/json instead.
Package herrera-io/phar-update is abandoned, you should avoid using it. No replacement was suggested.
Can runing ARM ?
example ArchLinux-arm
It's a good usage for desktop app to make a popup on right click.
The Radio component implements TRadioGroup. It would not be more appropriate to rename it to RadioGroup since there is also a component in LCL called TRadioButton. I understand that within the proposal to bring the nomenclature of components to the Web nomenclature, this change was in keeping with the fact that the present Radio is in fact a group of Radios.
Currently, we have a self created main form (Form1). The ideia is to:
I am trying to implement TFileNameEdit and I encountered problems using the DialogFiles property to return the selected files, regardless of whether or not the ofAllowMultiSelect is used.
TFileNameEdit.DialogFiles seems to return a string collection with the name of the selected files. The return type is TStrings.
From what I saw in the source code in Lazarus, TIpcThread.GetObjectProperty always returns a string, but in the specific case the conversion done by VarToStr (propertyValue) is not returning anything.
In addition could you tell me the way to fix this, since TFileNameEdit only provides that property to access all the selected files.
Is it possible to run applications written without opening the console in the background?
Good Idea..
Looks similar to GTKserver Project. ( so why restrained with just PHP, right? )
Seperating GUI and App Logic should eliminate UI hangout problems inherent in PHP GUI solutions. ( unless protocol is "sync". )
I compiled the executable but...
Is there a protocol documention? ( So one may write his/her own proxy libs. )
How we talk to executable? (I am illiterate in Pascal)
Keep up the excellent work...
For PHP, it's more easy to use RGB on color properties. On Lazarus, we will need to convert the RGB to TColor (and vice-versa).
Unfortunately, Windows itself does not support non-blocking I/O on Windows pipes, which includes the standard handles used for CreateProcess(). It's an issue leftover from the early days of Windows and not something that Microsoft can easily fix or they would have already fixed it. You've accidentally run into a fundamental low-level Win32 CreateProcess() API bug. Since standard handles are almost always blocking pipes, an application might be expecting input on stdin while, at the same time, PHP is blocking while waiting for output on stdout. That, of course, creates difficult-to-diagnose issues resulting in application freezes usually on the PHP end of things. This behavior only happens on Windows and it's an easy issue to miss in cursory testing.
However, there is a workaround for standard handle applications where there is no source code control available or where the code would be too complicated to fix on the application's end of things:
https://bugs.php.net/bug.php?id=47918
An alternative could be to set up a localhost TCP/IP server on a random port (via port 0) in the PHP application, then start the Lazarus app and send the port number as part of the command line arguments or environment variables. The Lazarus app picks off the port number and connects back into the PHP application using a TCP/IP socket. Both sides enable non-blocking mode. At that point, the PHP side can terminate the TCP/IP server since it won't need to accept any more connections and then communication happens over localhost TCP/IP. By using TCP/IP, both the application and PHP can completely avoid the issue of attempting to use blocking stdin/stdout for non-blocking bidirectional IPC.
Since this project depends on react/child-process
, the following bug report is relevant:
I found PHP-GUI while evaluating options for solving a chicken-or-the-egg problem. Given the size of the binaries in this project and what I know about standard handle issues on Windows for IPC, I'm probably going to pass and try to figure out something simpler.
Side note: Each GitHub project is limited to 1GB total storage. Pure source code repos will likely never hit that limit. Large binaries that change frequently can use that storage up pretty quickly - I hit one of GitHub's internal storage limits once upon a time. This repo currently uses around 120MB of storage according to: https://api.github.com/repos/gabrielrcouto/php-gui Just something to keep in mind. On a related side-note, I've always been impressed with the extremely small file sizes of both the useful native Windows software produced by nirsoft and those participating in the not-as-useful-but-cool 4k and 64k demoscenes.
File | Todo | PRs | Done |
---|---|---|---|
src/Application.php:200 | @todo: Check if the object exists | #51 | ✅ |
src/Application.php:316 | @todo: Put the message on a poll | ⬜ | |
src/Application.php:335 | @todo: Put the message on a poll | ⬜ | |
src/Components/Radio.php:33 | @todo: throw an exception | #88 | ✅ |
src/Ipc/Receiver.php:141 | @todo: throw an exception | #58 | ✅ |
src/Ipc/Receiver.php:253 | @todo: Command implementation | ⬜ | |
src/Ipc/Sender.php:129 | @todo: throw an exception | ⬜ |
Fatal error: Cannot use Gui\Components\Object as Object because 'Object' is a sp
ecial class name in D:\phpgui\vendor\gabrielrcouto\php-gui\src\Application.php o
n line 5
Not urgent,but would be a problem.
big thanks for this project!
Source: Reddit
"We can remove about 32MB of the lazarus directory, it's filled with compilation artifacts."
Would be a good if PHP-GUI support IFrame and/or manipulating native browsers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.