PHPackages                             rosio/php-to-javascript-variables - 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. rosio/php-to-javascript-variables

ActiveLibrary

rosio/php-to-javascript-variables
=================================

v1.0.1(11y ago)1151PHPPHP &gt;=5.3.0

Since May 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Rosio/php-to-javascript-variables)[ Packagist](https://packagist.org/packages/rosio/php-to-javascript-variables)[ RSS](/packages/rosio-php-to-javascript-variables/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

PHP To JavaScript Variables
===========================

[](#php-to-javascript-variables)

[![Build Status](https://camo.githubusercontent.com/58e35d1738bc461945d83ac61824bc5a3e4909e0e0c365d0443789a4eaa1e81e/68747470733a2f2f636972636c6563692e636f6d2f67682f526f73696f2f7068702d746f2d6a6176617363726970742d7661726961626c65732e706e673f636972636c652d746f6b656e3d61373737623330333666356661323663323636376235666662363363313838353161346163306136)](https://camo.githubusercontent.com/58e35d1738bc461945d83ac61824bc5a3e4909e0e0c365d0443789a4eaa1e81e/68747470733a2f2f636972636c6563692e636f6d2f67682f526f73696f2f7068702d746f2d6a6176617363726970742d7661726961626c65732e706e673f636972636c652d746f6b656e3d61373737623330333666356661323663323636376235666662363363313838353161346163306136)

Simple package which allows easy sharing of variables from PHP to JavaScript. This is a rewrite of the [laracasts/utilities](https://github.com/laracasts/PHP-Vars-To-Js-Transformer) package. I was prompted to do this due to the aformentioned package requiring PHP 5.4+, and I disliked their design.

Installation
------------

[](#installation)

composer.json

```
"require": {
	...
	"rosio/php-to-javascript-variables": "~1.0"
}
```

config/app.php

```
'providers' => array(

	...
	'Rosio\PhpToJavaScriptVariables\PhpToJavaScriptVariablesServiceProvider',

),
```

Usage
-----

[](#usage)

controllers\\HomeController.php

```
	public function showWelcome()
	{
		JSLocalize::put(array(
			'variableName' => 'variableValue',
			'anotherVariable' => array(1, 2, 3)
		));

		return View::make('hello');
	}
```

views\\hello.php

```

	...
	{{ App::make('JSLocalizeDumper')->dump() }}
	...

		alert(app.variableName);

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

4

Last Release

4352d ago

Major Versions

v0.0.2 → v1.0.02014-06-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/733673099c75cb3d61b12b290783b59ecfa31d4ebcdf2ac62bbd5540b238138d?d=identicon)[ben-rosio](/maintainers/ben-rosio)

### Embed Badge

![Health badge](/badges/rosio-php-to-javascript-variables/health.svg)

```
[![Health](https://phpackages.com/badges/rosio-php-to-javascript-variables/health.svg)](https://phpackages.com/packages/rosio-php-to-javascript-variables)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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