xactsystems/js-routing-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xactsystems/js-routing-bundle

Composer 安装命令:

composer require xactsystems/js-routing-bundle

包简介

A JS routing bundle for Symfony 4+ using webpack. Derived from the FOS JSRoutingBundle. See 3.4 branch for Symfony 3.4.

README 文档

README

This bundle allows you to expose your Symfony routes and use them in your webpack managed JavaScript code. It allows you to easily integrate the functionality of the FOSJsRoutingBundle into webpack modules.

Documentation

1) Add JSRoutingBundle to your project

composer require xactsystems/js-routing-bundle

For Symfony 3.4 use:

composer require xactsystems/js-routing-bundle:^3.4

2) Include the routing template in your base Twig template

// templates/base.html.twig

{{ include("@XactJSRouting/js-routing.html.twig") }}

3) Include the JS module in your App.js

// assets/js/App.js

// Import the JS routing scripts
import '../../vendor/xactsystems/js-routing-bundle/assets/js-routing.js';

The actual path to the js-routing.js file may not be exactly as shown, you may need to adjust this for your own project.

4) Using the routing class, exactly as you would with FOS bundle

// Get the URL of your routes
let url1 = Routing.generate('home');
let url2 = Routing.generate('some-other-route', {id: myLocalId, state: myLocalState});

5) For Symfony 3.4, if you are not using Flex and ENV you may need to add the following:

// app/AppKernel.php

    public function registerBundles()
    {
        // You many need to do this to get the render(controller()) Twig method working for XactJSRoutingBundle
        $_ENV["APP_ENV"] = $this->getEnvironment();

And for the Symfony Serializer component:

// app/config/config.yml

framework:
    ...
    # If you haven't already enabled the Symfony Serializer
    serializer: { enabled: true }

Credits

  • Ian Foulds as the creator of this package.
  • William DURAND as author of the FOS bundle.
  • Julien MUETTON (Carpe Hora) for the inspiration.

License

This bundle is released under the MIT license. See the complete license in the bundle:

LICENSE

统计信息

  • 总下载量: 1.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固