triplepoint/php-units-of-measure-bundle

此包的最新版本(dev-master)没有可用的许可证信息。

Symfony PhpUnitsOfMeasureBundle

安装: 114

依赖者: 0

建议者: 0

安全: 0

星级: 3

关注者: 2

分支: 0

类型:symfony-bundle

dev-master 2014-10-15 01:13 UTC

This package is auto-updated.

Last update: 2024-09-16 18:50:44 UTC


README

PhpUnitsOfMeasureBundle 提供了将 php-units-of-measure 库集成到 Symfony2 框架中的功能。

特性

Twig 过滤器列表

  • um_acceleration
  • um_angle
  • um_area
  • um_electric_current
  • um_length
  • um_luminous_intensity
  • um_mass
  • um_pressure
  • um_temperature
  • um_velocity
  • um_volume

安装和配置

将 PhpUnitsOfMeasureBundle 添加到您的应用程序内核

<?php

    // app/AppKernel.php
    public function registerBundles()
    {
        return array(
            // ...
            new Triplepoint\PhpUnitsOfMeasureBundle\TriplepointPhpUnitsOfMeasureBundle(),
            // ...
        );
    }

使用示例

Twig 扩展示例

转换过滤器

  • {{ '5000' | um_length('m', 'km') }} 将 5000 米转换为 5 公里

  • {{ '0.5' | um_acceleration }} 使用默认单位将 0.5 m/s2 转换为 6480 km/h2

未来工作

  • 允许覆盖测量类