Skip to content

Commit 7ced7b5

Browse files
committed
Create README.md
1 parent caf4739 commit 7ced7b5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
JavaScript-Variables
2+
============
3+
Sent variables into JavaScript. Can be used standalone or with a Laravel service provider.
4+
5+
### Installation
6+
Add to your composer.json file
7+
```json
8+
"dowilcox/knp-menu-laravel": "dev-master"
9+
```
10+
11+
```php
12+
$jsVar = new Dowilcox\JsVar\JsVar('namespace');
13+
```
14+
15+
### Installation (Laravel)
16+
17+
In config/app.php add the service provider and alias.
18+
19+
```php
20+
'Dowilcox\JsVar\JsVarServiceProvider',
21+
```
22+
23+
```php
24+
'Menu' => 'Dowilcox\JsVar\Facades\JsVar',
25+
```
26+
27+
### Example
28+
29+
```php
30+
$jsVar->add('key', 'value');
31+
32+
echo $jsVar->dump();
33+
```
34+
35+
Will output:
36+
```javascript
37+
window.namespace = window.namespace || {key: 'value'};
38+
```

0 commit comments

Comments
 (0)