Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

friendsofsymfony/jsrouting-bundle 3.4.1

A pretty nice way to expose your Symfony routing to client applications.
Package summary
Share
0
issues
0
licenses
Package created
1 Nov 2011
Version published
15 Dec 2023
Maintainers
2
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does friendsofsymfony/jsrouting-bundle do?

The FriendsofSymfony JS Routing Bundle - often abbreviated as FOSJsRoutingBundle - serves as a valuable resource for exposing your Symfony routing configuration to your JavaScript applications. It essentially enables your JavaScript code to generate URLs with specified parameters, similar to what you can do with the Router component available in the Symfony core. The FOSJsRoutingBundle can be considered as a progressive port of the Symfony 1.x plugin chCmsExposeRoutingPlugin.

How do you use friendsofsymfony/jsrouting-bundle?

To utilize the power of FOSJsRoutingBundle in exposing your Symfony routes, you must first install the bundle through Composer. Use the command composer require friendsofsymfony/jsrouting-bundle from your terminal to include this bundle within your project. Once it's installed, make sure to enable the bundle in your AppKernel.php file with new FOS\JsRoutingBundle\FOSJsRoutingBundle().

Afterward, in your routing configuration file - often routing.yml - make sure to import JS routing definitions:

fos_js_routing:
    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"

You can then create routes in your Symfony application like usual. However, to expose certain routes to your JavaScript, you need to add the option _expose and set it to true in your routing config:

app_my_route:
    path: /my_route/{param}
    defaults: { _controller: AppBundle:Default:index }
    options:
        expose: true

With this setup, you can generate routes with parameters on the client-side using the Routing.generate method available in JavaScript:

var url = Routing.generate('app_my_route', {param: 'my_param'});

Note that this is a basic example. More complex applications might require different or additional configurations.

Where are the friendsofsymfony/jsrouting-bundle docs?

To delve into FOSJsRoutingBundle and fully understand its capabilities and utilization, it's recommended to refer to its detailed documentation available. It can be accessed online at https://symfony.com/doc/master/bundles/FOSJsRoutingBundle/index.html. This is the official documentation for FOSJsRoutingBundle and it provides comprehensive guidance on how to effectively implement its features into your Symfony applications.