PHPackages                             sqonk/phext-visualise - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. sqonk/phext-visualise

ActiveLibrary[Image &amp; Media](/categories/media)

sqonk/phext-visualise
=====================

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.

1.0.2(3mo ago)118511MITPHPPHP ^8.0

Since Feb 1Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/sqonk/phext-visualise)[ Packagist](https://packagist.org/packages/sqonk/phext-visualise)[ RSS](/packages/sqonk-phext-visualise/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (1)

PHEXT Visualise
===============

[](#phext-visualise)

[![Minimum PHP Version](https://camo.githubusercontent.com/a059fb88d3ff5fe22ed8bf35e3309c8ce74b414e8efe9cf66b7cc7a111ae78b9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344253230382d79656c6c6f77)](https://php.net/) [![Minimum PHP Version](https://camo.githubusercontent.com/6a2d72873987455c9cfb8e1b1829899c84aac0232e242e730703b4e13995312b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4a6176612d253345253344253230382d707572706c65)](https://adoptopenjdk.net) [![License](https://camo.githubusercontent.com/e3d584625d5a65f768ca34cf2e2486fe3578f7f9f7f6c1c07548809f8ca8c0f2/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f6c6963656e73652e737667)](license.txt)

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
-------

[](#install)

Via Composer

```
$ composer require sqonk/phext-visualise
```

### Requirements

[](#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
-------------

[](#api-reference)

Please see the [API Reference](docs/api/index.md) for full documentation of available methods.

Philosophy
----------

[](#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?
---------

[](#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](https://adoptopenjdk.net).

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
--------

[](#examples)

Run a series of graphs using [PlotLib](https://github.com/sqonk/phext-plotlib), 4 in total, and output all of them to 1 window, rending a new x-series value with each loop.

```
require_once 'vendor/autoload.php';

use sqonk\phext\visualise\Visualiser;
use sqonk\phext\plotlib\BulkPlot;

$visualiser = new Visualiser;
$windowID = $visualiser->open(title:'graphs', width:1000, height:850, imageCount:4, posX:20, posY:25);

$values = [];
$xs = [];
foreach (sequence(start:1, end:100) as $i)
{
    $values[] = rand(1,30);
    $xs[] = $i;

    $plot = new BulkPlot;
    $plot->add(type:'line', series:[$values], options:[
        'title' => 'Lines',
        'xseries' => $xs,
    ]);
    $plot->add(type:'bar', series:[$values], options:[
        'title' => 'Bars',
        'xseries' => $xs,
    ]);
    $plot->add(type:'linefill', series:[$values], options:[
        'title' => 'Area',
        'xseries' => $xs,
    ]);
    $plot->add(type:'scatter', series:[$values], options:[
        'title' => 'Scatter Plot',
        'xseries' => $xs,
    ]);

    $images = $plot->render(writeToFile:false, width:500, height:400);
    $visualiser->update(images:$images, windowID:$windowID);
}
ask('press any key to continue.'); // pause script.
```

[![Graphs](examples/graphs.gif)](examples/graphs.gif)

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:

```
require_once 'vendor/autoload.php';

use sqonk\phext\visualise\Visualiser;

$visualiser = new Visualiser;

function adjust($sq): void {
    $sq->size = $sq->dir ? $sq->size + $sq->step : $sq->size - $sq->step;
    if ($sq->size > 350)
        $sq->dir = false;
    else if ($sq->size < 5)
        $sq->dir = true;
}

$Sq = named_objectify('size', 'dir', 'step', 'r', 'g', 'b');
$squares = [
  $Sq(5, true, 10, 147,17,50),
  $Sq(20, true, 5, 148,32,146),
  $Sq(20, true, 15, 0,0,200)
];
foreach ($visualiser->animate(400, 400, title:'Squares', frames:1000, posX:20, posY:50) as $count => $img)
{
    # prefill white background
    $white = imagecolorallocate($img, 255,255,255);
    imagefilledrectangle(image:$img, x1:0, y1:0, x2:399, y2:399, color:$white);

    imagesetthickness($img, 3);
    foreach ($squares as $s) {
        $r = $s->size / 2;
        $clr = imagecolorallocate(image:$img, red:$s->r, green:$s->g, blue:$s->b);

        imagerectangle(image:$img, x1:200-$r, y1:200-$r, x2:200+$r, y2:200+$r, color:$clr);

        adjust($s);
    }
}

println('completed.');
```

[![Sine Wave](examples/squares.gif)](examples/squares.gif)

Credits
-------

[](#credits)

Theo Howell

License
-------

[](#license)

The MIT License (MIT). Please see [License File](license.txt) for more information.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance78

Regular maintenance activity

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~604 days

Total

4

Last Release

119d ago

Major Versions

0.9 → 1.02021-02-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/d613b1fb90e5ed5b8207818496ae9c90b7d3b54890803f0af3279c2e7fbd9771?d=identicon)[sqonk](/maintainers/sqonk)

---

Top Contributors

[![sqonk](https://avatars.githubusercontent.com/u/55817417?v=4)](https://github.com/sqonk "sqonk (68 commits)")

---

Tags

imagegraphicsguidisplayvisualisationgraphical output

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sqonk-phext-visualise/health.svg)

```
[![Health](https://phpackages.com/badges/sqonk-phext-visualise/health.svg)](https://phpackages.com/packages/sqonk-phext-visualise)
```

###  Alternatives

[intervention/image

PHP Image Processing

14.3k194.3M2.2k](/packages/intervention-image)[imagine/imagine

Image processing for PHP

4.5k72.4M341](/packages/imagine-imagine)[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k51.2M116](/packages/league-glide)[liip/imagine-bundle

This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.

1.7k38.3M217](/packages/liip-imagine-bundle)[spatie/image

Manipulate images with an expressive API

1.4k54.4M138](/packages/spatie-image)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
