Because this library requires threads, it does not work with the usual version of PHP. The required version of PHP (https://www.php.net/manual/en/book.pthreads.php) is not easy to install (https://www.php.net/manual/en/pthreads.installation.php), hence probably the fact that nobody has ever used the PHP version of the Atlas toolkit.
As a result, the development of this library is interrupted, but could be resumed if the situation regarding the ZTS (https://www.php.net/manual/en/pthreads.requirements.php) version ever improves .
A fast and easy way to write PHP programs with a graphical user interface (SPA like program).
With the Atlas toolkit, you obtain hybrid programs. Like desktop applications, the same code can handle both front and back ends, and, like web applications, the programs will be reachable from all over the internet.
Here's how a Hello, World! type program made with the Atlas toolkit looks like:
git clone http://github.com/epeios-q37/atlas-php
cd atlas-php
php Hello/Hello.php
(with the pthreads extension)
For a live demonstration: http://q37.info/runkit/Hello.
Source code:
<?php
require "phar://Atlas.phar/Atlas.php";
class Hello extends Threaded {
static $body = <<<EOT
<div style="display: table; margin: 50px auto auto auto;">
<fieldset>
<input id="input" maxlength="20" placeholder="Enter a name here" type="text"
data-xdh-onevent="Submit" value="World"/>
<div style="display: flex; justify-content: space-around; margin: 5px auto auto auto;">
<button data-xdh-onevent="Submit">Submit</button>
<button data-xdh-onevent="Clear">Clear</button>
</div>
</fieldset>
</div>
EOT;
public function handle($dom, $action, $id) {
switch ($action) {
case "": // Action label for a new connection.
$dom->setLayout("", self::$body);
break;
case "Submit":
$dom->alert("Hello, " . $dom->getContent("input") . "!");
break;
case "Clear":
if ($dom->confirm("Are you sure?"))
$dom->setContent("input", "");
break;
}
$dom->focus("input");
}
}
function hello() {
return new Hello();
}
Atlas::launch('hello');
?>
And here's how the Atlas toolkit version of the TodoMVC application looks like:
For a live demonstration: http://q37.info/runkit/TodoMVC.
The Atlas
directory contains the PHP source code of the Atlas toolki, which is not needed to run the examples.
Atlas.phar
is the file which is needed to use the Atlas toolkit in your own program.
All other directories are examples.
To run an example, launch php <Name>/main.php
, where <Name>
is the name of the example (Blank
, Chatroom
…).
NOTA: You need PHP with pthreads!
The Atlas toolkit is also available for:
- Java: http://github.com/epeios-q37/atlas-java
- Node.js: http://github.com/epeios-q37/atlas-node
- Perl: http://github.com/epeios-q37/atlas-perl
- Python: http://github.com/epeios-q37/atlas-python
- Ruby: http://github.com/epeios-q37/atlas-ruby
For more information about the Atlas toolkit: http://atlastk.org/.