PHPackages                             lgm/pgfx - 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. lgm/pgfx

ActiveProject

lgm/pgfx
========

1.2.0(4y ago)0151MITPHPPHP &gt;=8.0

Since Aug 30Pushed 4y ago1 watchersCompare

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

READMEChangelog (6)Dependencies (2)Versions (7)Used By (1)

pgfx
====

[](#pgfx)

Library for simplify creating vector graphics in PHP.

Inspired by AS3 Graphics API.

### Example vector graphics

[](#example-vector-graphics)

```
use pgfx\display\Graphics;
use pgfx\renderer\gd\GdImageRenderer;

$graphics = new Graphics();
$graphics->beginFill(0x787878);
$graphics->lineStyle(1, 0x00ffff);
$graphics->moveTo(50, 50);
$graphics->lineTo(150, 50);
$graphics->lineTo(150, 150);
$graphics->lineTo(50, 50);
$graphics->lineTo(50, 150);
$graphics->lineTo(150, 150);
$graphics->endFill();

$renderer = new GdImageRenderer(200, 200);
$renderer->setBackgroundColor(0x232323);
$renderer->render($graphics);
```

### Example animation

[](#example-animation)

```
use pgfx\attribute\PGFX;
use pgfx\display\Graphics;
use pgfx\display\Stage;
use pgfx\geom\Point;
use pgfx\renderer\gd\GdImageRenderer;

class Particle
{
    public function __construct(private int   $size,
                                private int   $color,
                                private Point $position,
                                private Point $direction)
    {
    }

    public function move(): void
    {
        $this->position = $this->position->add($this->direction);
    }

    public function draw(Graphics $graphics): void
    {
        $graphics->beginFill($this->color);
        $graphics->lineStyle(1, 0x000000);
        $graphics->drawCircle($this->position->x, $this->position->y, $this->size);
        $graphics->endFill();
    }
}

#[PGFX(frameCount: 25, frameRate: 5, wight: 200, height: 100)]
class ExampleAnimation extends Stage
{
    /** @var array */
    private array $particles = [];

    function onAddedToStage(): void
    {
        for ($itr = 0; $itr < 100; $itr++) {
            $this->particles[] = new Particle(
                rand(2, 7),
                rand(0x780000, 0x870000),
                new Point(),
                new Point(rand(1, 200) / 10, rand(1, 200) / 10)
            );
        }
    }

    function onEnterFrame(): void
    {
        foreach ($this->particles as $particle) {
            $particle->move();
            $particle->draw($this->graphics);
        }
    }
}

$renderer = new GdImageRenderer();
$renderer->renderStage(new ExampleAnimation());
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

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 ~35 days

Recently: every ~44 days

Total

6

Last Release

1539d ago

Major Versions

0.0.2 → 1.0.02021-09-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/167983?v=4)[lgmaj](/maintainers/lgmaj)[@lgmaj](https://github.com/lgmaj)

---

Top Contributors

[![lgmaj](https://avatars.githubusercontent.com/u/167983?v=4)](https://github.com/lgmaj "lgmaj (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lgm-pgfx/health.svg)

```
[![Health](https://phpackages.com/badges/lgm-pgfx/health.svg)](https://phpackages.com/packages/lgm-pgfx)
```

PHPackages © 2026

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