PHPackages                             yazvonov/laravel-tojs - 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. yazvonov/laravel-tojs

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

yazvonov/laravel-tojs
=====================

Transform PHP Vars to JavaScript for Laravel

v1.1(4y ago)102.2k↓33.3%1MITPHPPHP ^7.0|^8.0

Since Nov 19Pushed 4y ago6 watchersCompare

[ Source](https://github.com/yazvonov/laravel-tojs)[ Packagist](https://packagist.org/packages/yazvonov/laravel-tojs)[ Docs](https://github.com/yazvonov/laravel-tojs)[ RSS](/packages/yazvonov-laravel-tojs/feed)WikiDiscussions main Synced 1mo ago

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

Transform PHP Vars to JavaScript for Laravel
============================================

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

How to install
--------------

[](#how-to-install)

```
composer require yazvonov/laravel-tojs

```

What It Does
------------

[](#what-it-does)

This package Transform PHP Vars to JavaScript.

Put variables

```
ToJs::put([
    'variable1' => 'I want to see you in JavaScript',
    'variable2' => 'I want to see you in JavaScript too',
]);
```

Add tag **@tojs** to you blade template before &lt;script&gt;

```
@tojs
```

You will see this code on you page, and you can you it in JavaScript like **window.laravel.variable1, window.laravel.variable2**

```
window.laravel = {"variable1":"I want to see you in JavaScript","variable2":"I want to see you in JavaScript too"};
```

Configuration
-------------

[](#configuration)

You can change name in javascript, just add

```
TOJS_VAR_NAME=another_name

```

to your .env file.

### Security

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community10

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

Total

2

Last Release

1552d ago

PHP version history (2 changes)v1.0PHP ^7.2

v1.1PHP ^7.0|^8.0

### Community

Maintainers

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

---

Top Contributors

[![yazvonov](https://avatars.githubusercontent.com/u/40278795?v=4)](https://github.com/yazvonov "yazvonov (11 commits)")

---

Tags

javascriptlaravelphplaraveljavascriptJStojs

### Embed Badge

![Health badge](/badges/yazvonov-laravel-tojs/health.svg)

```
[![Health](https://phpackages.com/badges/yazvonov-laravel-tojs/health.svg)](https://phpackages.com/packages/yazvonov-laravel-tojs)
```

###  Alternatives

[stolz/assets

An ultra-simple-to-use assets management library

296519.2k8](/packages/stolz-assets)

PHPackages © 2026

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