PHPackages                             dup/vanphp - 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. dup/vanphp

ActiveLibrary

dup/vanphp
==========

0.1.2(2y ago)17PHP

Since Jul 12Pushed 2y ago1 watchersCompare

[ Source](https://github.com/groovenectar/VanPHP)[ Packagist](https://packagist.org/packages/dup/vanphp)[ RSS](/packages/dup-vanphp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

VanPHP
======

[](#vanphp)

A mechanism to build a [VanJS](https://vanjs.org) (or HTML) DOM tree using PHP.

Example
-------

[](#example)

The following PHP code:

```
require(__DIR__ . '/../vendor/autoload.php');

use Dup\VanPHP\DomElement;
use Dup\VanPHP\DomElement\Renderer\JsFunc;

$v = new DomElement\Factory(new DomElement\Output\VanJs);

echo $v->label(
	['for' => 'testInput'],
	$v->div('Label text wrapped in nested div'),
	'Label text not wrapped in div',
	$v->input(['type' => 'text', 'id' => 'testInput']),
	$v->button(['onclick' => fn() => new JsFunc(__DIR__ . '/OnClickFunc.js')], 'Click Me')
) . "\n";
```

Outputs the following VanJS DOM tree (indented for readability):

```
label(
	{ for: "testInput" },
	div("Label text wrapped in nested div"),
	"Label text not wrapped in div",
	input({ type: "text", id: "testInput" }),
	button(
		{
			onclick: (e) => {
				e.preventDefault()
				alert(document.getElementById('testInput').value)
			}
		},
		"Click Me"
	)
)
```

The following PHP code with the same input syntax:

```
echo $h->label(
	['for' => 'testInput'],
	$h->div('Label text wrapped in div'),
	'Label text not wrapped in div',
	$h->input(['type' => 'text', 'id' => 'testInput']),
	$h->button(['onclick' => fn() => new JsFunc(__DIR__ . '/OnClickInline.js')], 'Click Me')
) . "\n";
```

Outputs the following HTML DOM tree (indented for readability):

```

    Label text wrapped in div
    Label text not wrapped in div

    Click Me

```

Why?
----

[](#why)

One possible use case that comes to mind is SSR for VanJS generated from PHP, since this can generate both HTML and VanJS with the same style of input.

Consider this example:

```
function renderOutput($e) {
	return $e->label(
		['for' => 'testInput'],
		$e->div('Label text wrapped in nested div'),
		'Label text not wrapped in div',
		$e->input(['type' => 'text', 'id' => 'testInput']),
		$e->button(['onclick' => fn() => new JsFunc(__DIR__ . '/OnClickFunc.js')], 'Click Me')
	) . "\n";
}

$e = new DomElement\Factory(new DomElement\Output\Html);
echo renderOutput($e);

$e->output = new DomElement\Output\VanJs;
echo renderOutput($e);
```

In this case, the same input from `renderOutput()` is being used to generate both HTML and VanJS DOM.

Getting started
---------------

[](#getting-started)

Via Composer:

```
mkdir VanPHP && cd VanPHP
composer require groovenectar/vanphp
php vendor/groovenectar/vanphp/test/test.php
```

Via Git:

```
git clone https://github.com/groovenectar/VanPHP.git && cd VanPHP
php test/test.php

# Optionally use Composer for autoloading
composer dump-autoload
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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

Total

3

Last Release

1038d ago

### Community

Maintainers

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

### Embed Badge

![Health badge](/badges/dup-vanphp/health.svg)

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

PHPackages © 2026

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