PHPackages                             moon/utilities-javascript - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. moon/utilities-javascript

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

moon/utilities-javascript
=========================

Transform your PHP to JavaScript

1.0.3(10y ago)1180MITPHPPHP &gt;=5.4.0

Since Jul 28Pushed 10y ago1 watchersCompare

[ Source](https://github.com/moon0326/PHP-Vars-To-Js-Transformer)[ Packagist](https://packagist.org/packages/moon/utilities-javascript)[ RSS](/packages/moon-utilities-javascript/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Transform PHP Vars to JavaScript
================================

[](#transform-php-vars-to-javascript)

This is forked version of

Goal of this fork: Remove framework and ViewBinder dependency to make it usable in any PHP projects.

\####Changes

- Added set($key, $value)
- Replaced buildJavaScriptSyntax(array $vars) with build(array $vars). build(array $vars) collects variables set by set($key, $value) and return transformed javascript variables.

#### Installation

[](#installation)

{ "require": { "moon/utilities-javascript": "~1.0" } }

#### Usage

[](#usage)

```
use Moon\Utilities\Javascript\PHPToJavaScriptTransformer;

$transformer = new PHPToJavaScriptTransformer;

// example 1
$javascript = $transformer->set('name', 'moon')
			->set('age', 999999)
            ->transform()

// example 2
$javascript = $transformer->transform([
	'name' => 'moon',
    'age' => 999999
]);

// in your view

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 81.6% 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 ~0 days

Total

4

Last Release

3947d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/737453219c222a6a34e24e2883c2225d19753a1032b38f4b13eab490b928079e?d=identicon)[moon0326](/maintainers/moon0326)

---

Top Contributors

[![JeffreyWay](https://avatars.githubusercontent.com/u/183223?v=4)](https://github.com/JeffreyWay "JeffreyWay (40 commits)")[![willvincent](https://avatars.githubusercontent.com/u/689891?v=4)](https://github.com/willvincent "willvincent (4 commits)")[![spamoom](https://avatars.githubusercontent.com/u/99203?v=4)](https://github.com/spamoom "spamoom (2 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (1 commits)")[![holyspecter](https://avatars.githubusercontent.com/u/4248110?v=4)](https://github.com/holyspecter "holyspecter (1 commits)")[![tyloo](https://avatars.githubusercontent.com/u/611035?v=4)](https://github.com/tyloo "tyloo (1 commits)")

---

Tags

laraveljavascript

### Embed Badge

![Health badge](/badges/moon-utilities-javascript/health.svg)

```
[![Health](https://phpackages.com/badges/moon-utilities-javascript/health.svg)](https://phpackages.com/packages/moon-utilities-javascript)
```

###  Alternatives

[lord/laroute

Access Laravels URL/Route helper functions, from JavaScript.

8022.0M8](/packages/lord-laroute)[unisharp/laravel-ckeditor

JavaScript WYSIWYG web text editor (for laravel).

377762.3k5](/packages/unisharp-laravel-ckeditor)[efficiently/jquery-laravel

This package provides jQuery and the jQuery-ujs driver for your Laravel &gt;= 6 application.

1311.0k1](/packages/efficiently-jquery-laravel)

PHPackages © 2026

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