Download the PHP package sqonk/phext-visualise without Composer
On this page you can find all versions of the php package sqonk/phext-visualise. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sqonk/phext-visualise
More information about sqonk/phext-visualise
Files in sqonk/phext-visualise
Package phext-visualise
Short Description Visualise is a cross platform non-interactive graphics output display for PHP 8 over the command line SAPI. It displays rendered images in a window with the ability for real-time updates using Java as the engine.
License MIT
Informations about the package phext-visualise
PHEXT Visualise
Visualise is a cross-platform non-interactive realtime graphics output display for PHP 8 over the command line SAPI.
Image frames can either be constructed with GD and passed to Visualise directly or produced or acquired via other means (e.g. from file or URL) by providing the pre-rendered image data as a string.
It uses the Java platform running under a sub-process that binds each window to the parent PHP script using the PCNTL extension.
Install
Via Composer
Requirements
- PHP 8.0+
- PCNTL extension
- POSIX extension
- GD extension
- Java 8+ (Either OracleJDK or OpenJDK).
You must have the full JDK installed, not just the JRE, which installs both java and javac (compiler) tools.
API Reference
Please see the API Reference for full documentation of available methods.
Philosophy
When attempting to build simple scripts or a proof of concept the inclination is to keep any output text-based and within the confines of the command line. While this avoids a lot of extra bulk and work necessary to make a program function with a graphical UI, it also restricts the type of information that can be displayed to the user (usually the developer writing the code).
Desktop graphical user interfaces typically come with event loops and other control frameworks that force that you structure your code to fit within their system.
Likewise Web apps, PHP's primary domain of usage, run over request-response cycles that spawn new running instances of a script with every run.
Both scenarios add a necessary level of complication that adds to the development time.
Maybe you are trialing a proof-of-concept idea that you would like to get up and running quickly, or you have simple requirements for a command line script but would like graphical updates to be displayed on screen without having to vastly change your logic. Visualise can solve this problem by fitting in with your code instead of the other way round.
Why Java?
Native PHP extensions have a nasty habit of breaking with nearly every major release of the language. For the various extensions that supported GUI bindings - as soon as the maintainers lost interest or otherwise moved on, compatibility was lost with successive revisions to the language.
By contrast user-land solutions have a better track record of weathering changes to the language and platform.
Java has been around since the 90s, widely used in enterprise and runs reliably on OS X, Linux and Windows. Further to that, the engine comes with pre-packaged installers available for all three platforms.
The Java side of Visualise requires no 3rd party Java libraries and makes use of tools that have been present in the language for most of its life, such as Swing UI.
Examples
Run a series of graphs using PlotLib, 4 in total, and output all of them to 1 window, rending a new x-series value with each loop.
When utilising only a single window and a single image you also have the option using a generator to simplify your code even further.
This simple animation demonstrates the usage:
Credits
Theo Howell
License
The MIT License (MIT). Please see License File for more information.