Download the PHP package gabrielrcouto/php-gui without Composer
On this page you can find all versions of the php package gabrielrcouto/php-gui. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gabrielrcouto/php-gui
More information about gabrielrcouto/php-gui
Files in gabrielrcouto/php-gui
Package php-gui
Short Description Extensionless PHP Graphic User Interface library
License MIT
Homepage http://github.com/gabrielrcouto/php-gui
Informations about the package php-gui
Extensionless PHP Graphic User Interface library
Table of Contents
- Why
- Requirements
- Usage
- Documentation
- How it works
- Contributors Guide
- TO-DO
- Credits
- License
Why
PHP can be more than a "Web Language", it's a fast language, with a cross platform interpreter and a good CLI. GUI is a natural step for completing this ecosystem.
For many years, GUI projects are being developed for PHP, like PHP-GTK, PHP-QT, wxPHP and so many others, but none of them became popular.
This project aims to solve the most common problems of existing "GUI Projects":
- The need for installing an extension
- Cross platform
- No external dependencies
- Easy to install (composer require php-gui) / Easy to use ($button = new Button)
Requirements
The following PHP versions are supported:
- PHP 5.6
- PHP 7
- HHVM
And OS:
- Linux x64
- Windows x64
- Mac OSX (tested on 10.10.x and 10.11.x)
Usage
Download the library using composer:
Stable version
Latest version (development)
Now, you can build a GUI application. Let's do a Hello World!
Create the file 'myapp.php':
Now, run it:
Simple? :clap: You don't need to compile anything, just download the library via composer and use it! :smile:
Documentation
We have a Documentation Page
But, if you want to see some examples, just follow the instructions below.
How it works
To create a GUI without the need for an extension, PHP executes a binary with proc_open and communicates with it using Stdin/Stdout Pipes--it's a fast and cross platform solution.
PHP <=> Stdin/Stdout Pipes <=> Lazarus Application <=> GUI
The binary is created using Lazarus (Free Pascal). After much research, I found a large advantage by using Lazarus over other desktop languages (like C#, Java...):
It doesn't have any dependencies (except for Linux, which needs GTK), has a good component library, is compiled, open source and has a nice slogan (Write Once, Compile Anywhere).
The communication (IPC) between PHP and Lazarus is performed using a protocol based on JSON RPC. You can view the specification here.
Contributors Guide
Components names
To be an easy to use library, this project will use HTML friendly names for the components, as PHP developers are more familiar with it.
Examples:
- On Lazarus, the property "caption" is for the text of a button. On php-gui, the property name is "value".
- On Lazarus, "Edit" is the component for text input, on php-gui, it's "InputText".
Compiling Lazarus App
On your Local Machine
First, you need to install Lazarus.
For compiling the lazarus binary:
Using Docker
If you are generating the Linux binary, you can use Docker:
Test
First install the dependencies, and after you can run:
TO-DO
The "Issues" page from this repository is being used for TO-DO management, just search for the "to-do" tag.