dowilcox / javascript-variables
Pass varaibles from PHP to JavaScript.
Installs: 1 634
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- illuminate/support: ~5.0
Requires (Dev)
- phpunit/phpunit: 4.5.*
This package is not auto-updated.
Last update: 2024-11-09 17:56:03 UTC
README
Send variables into JavaScript. Can be used standalone or with a Laravel service provider.
Installation
Add to your composer.json file
"dowilcox/javascript-variables": "dev-master"
$jsVar = new Dowilcox\JsVar\JsVar('namespace');
Installation (Laravel)
In config/app.php add the service provider and alias.
'Dowilcox\JsVar\JsVarServiceProvider',
'JsVar' => 'Dowilcox\JsVar\Facades\JsVar',
Example
$jsVar->add('key', 'value'); echo $jsVar->dump();
Will output:
window.namespace = window.namespace || {key: 'value'};