PHPackages                             najidev/javascript-data-bundle - 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. najidev/javascript-data-bundle

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

najidev/javascript-data-bundle
==============================

Integrates \\NajiDev\\Common\\JavaScriptData\\Container in your project in a nice way

1.0.2(13y ago)049MITPHPPHP &gt;=5.3.0

Since Nov 10Pushed 12y ago1 watchersCompare

[ Source](https://github.com/rejinka/najidev-javascriptdatabundle)[ Packagist](https://packagist.org/packages/najidev/javascript-data-bundle)[ RSS](/packages/najidev-javascript-data-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

NajiDevJavaScriptDataBundle
===========================

[](#najidevjavascriptdatabundle)

This bundle integrates \\NajiDev\\Common\\JavaScriptData\\Container into your project in a nice way, for having a bridge to get php variables to javascript. Take a look on the documentation of najidev/common.

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

[](#installation)

### Add bundle to composer.json

[](#add-bundle-to-composerjson)

As composer is the standard way of Symfony to handle libraries and bundles, i'll only show the installation with composer. In your composer.json add following:

```
"require" : {
	"najidev/javascript-data-bundle" : "@dev"
}

```

You should consider taking one of the releases instead of "@dev".

### Load the bundle in your Kernel

[](#load-the-bundle-in-your-kernel)

```
$bundles = array(
	// your current bundles

	new \NajiDev\JavaScriptDataBundle\NajiDevJavaScriptDataBundle(),
);

```

Usage
-----

[](#usage)

The bundle creates the service

```
najidev.common.javascriptdata.container

```

in your DIC, which is an instance of

```
\NajiDev\Common\JavaScriptData\Container

```

You just need to grab it by the DIC in your controller and use it:

```
$this->get('najidev.common.javascriptdata.container')->set('my.key', 'value');

```

Another way to interact with the data-container is the templating helper:

```
$view['javascript_data']->set('my.key', 'value');

```

When it comes to display the data, the helper has another method:

```

```

Just use that simple line in a layout and your data can everywhere be grabbed by the helper.js. Be sure to use the helper.js, when the body was completely rendered. Jquerys ready-event is just perfect for that:

```

	$(document).ready(function()
	{
		var value = jsd.get('my.key', 'a default value, which will be returned if such key does not exist');

		console.log(value);
	});

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

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

Total

3

Last Release

4809d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/573be161327ff6b6ae43158484a0d9049f822c7662cfb492e9766e58b70405b3?d=identicon)[Naji](/maintainers/Naji)

---

Top Contributors

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

---

Tags

phpjavascriptBridgevariable

### Embed Badge

![Health badge](/badges/najidev-javascript-data-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/najidev-javascript-data-bundle/health.svg)](https://phpackages.com/packages/najidev-javascript-data-bundle)
```

###  Alternatives

[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[symfony/ux-cropperjs

Cropper.js integration for Symfony

19280.3k3](/packages/symfony-ux-cropperjs)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)

PHPackages © 2026

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