hospect/php-vars-to-js-bundle 问题修复 & 功能扩展

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

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

hospect/php-vars-to-js-bundle

最新稳定版本:1.0.2

Composer 安装命令:

composer require hospect/php-vars-to-js-bundle

包简介

Transformation of PHP vars to JS for Symfony2 with Twig

README 文档

README

Build Status

Description

Bundle allows you to avoid horrible statements in Twig templates while setting JS variables from PHP ones, like:

var someJsVar = '{{ somePhpVar }}',
    anotherJsVar = '{{ anotherPhpVar }}';

Installation

Simply require it with composer:

composer require hospect/php-vars-to-js-bundle

And register in your AppKernel.php:

public function registerBundles()
{
    $bundles = array(
        // some other bundles...
        
        new \Hospect\PhpVarsToJsBundle\HospectPhpToJsBundle(),
    );
        
    return $bundles;
}

Usage

In your controller call:

$this->get('php_to_js')->put([
    'someJsVar' => $somePhpVar,
    // more vars here...
]);

Then in Twig template (probably that will be useful to move it to layout):

<script>
    {{ initPhpVars() }}
</script>

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固