Backbone.js Bundle for Symfony2
Current Version
Backbone.js 1.3.3, (*1)
Underscore.js 1.8.3, (*2)
Installation
Add bundle to your composer.json file
``` js
// composer.json, (*3)
{
"require": {
// ...
"alexandermatveev/backbone-bundle": "*"
}
}, (*4)
### Add bundle to your application kernel
``` php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new AlexanderMatveev\BackboneBundle\AlexanderMatveevBackboneBundle(),
// ...
);
}
Download the bundle using Composer
``` bash
$ php composer.phar update alexandermatveev/backbone-bundle, (*5)
### Install assets
Given your server's public directory is named "web", install the public vendor resources
``` bash
$ bin/console assets:install web
Optionally, use the --symlink attribute to create links rather than copies of the resources, (*6)
``` bash
$ bin/console assets:install --symlink web, (*7)
## Usage
Refer to the desired files in your HTML template, e.g.
``` html
<script type="text/javascript" src="{{ asset('bundles/alexandermatveevbackbone/js/underscore-min.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/alexandermatveevbackbone/js/backbone-min.js') }}"></script>
Licenses
Refer to the source code of the included files for license information, (*8)
References
- http://backbonejs.org/
- http://symfony.com