1. Go to this page and download the library: Download clue/zenity-react library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
clue / zenity-react example snippets
cher = new Clue\React\Zenity\Launcher();
$entry = new EntryDialog();
$entry->setText('What\'s your name?');
$entry->setEntryText(getenv('USER')); // prefill with current user
$launcher->launch($entry)->then(function ($name) use ($launcher) {
$launcher->launch(new InfoDialog('Welcome to zenity-react, ' . $name .'!'));
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
$launcher = new Clue\React\Zenity\Launcher();
$launcher->setBin('/some/other/path/zenity');
$result = $launcher->waitFor($dialog);
$launcher->launch($dialog)->then(
function ($result) {
// info dialogs complete with a boolean true result
// text dialogs complete with their respective text
},
function ($reason) {
// dialog was cancelled or there was an error launching the process
}
});
$zen = $launcher->launchZen($dialog);
Loop::addTimer(3.0, function () use ($zen) {
$zen->close();
});
$zen->promise()->then(function ($result) {
// dialog completed
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
$builder = new Builder();
$dialog = $builder->info('Hello world');