定制 midnightluke/php-units-of-measure-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

midnightluke/php-units-of-measure-bundle

最新稳定版本:v1.0.0-BETA1

Composer 安装命令:

composer require midnightluke/php-units-of-measure-bundle

包简介

Symfony bundle wrapper for the PHP Units of Measure library with useful doctrine and form types.

README 文档

README

Build Status Coverage Status

Provides useful Doctrine and Form types for working with the PHP Units of Measure Library.

Installation

Install this bundle using composer:

composer require midnightluke/php-units-of-measure-bundle:dev-master

Add it to your application kernel (AppKernel.php):

class AppKernel extends Kernel
{
    // [...]
    public function registerBundles()
    {
        $bundles = [
            // [...]
            new MidnightLuke\PhpUnitsOfMeasureBundle\MidnightLukePhpUnitsOfMeasureBundle(),
        ];
    }
    // [...]
}

Add the form types you need to doctrine in config.yml:

doctrine:
    dbal:
        types:
            acceleration:         MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\AccelerationType
            angle:                MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\AngleType
            area:                 MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\AreaType
            electric_current:     MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\ElectricCurrentType
            energy:               MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\EnergyType
            length:               MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\LengthType
            luminous_intensity:   MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\LuminousIntensityType
            mass:                 MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\MassType
            pressure:             MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\PressureType
            quantity:             MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\QuantityType
            solid_angle:          MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\SolidAngleType
            temperature:          MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\TemperatureType
            uom_time:             MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\TimeType
            velocity:             MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\VelocityType
            volume:               MidnightLuke\PhpUnitsOfMeasureBundle\Doctrine\Types\VolumeType

Configuration

This bundle comes with configuration that allows you to specify the "default" unit for each unit of measure form type. This can be configured in your app's config.yml file like so:

units_of_measure:
    base_units:
        acceleration:         m/s^2
        angle:                rad
        area:                 m^2
        electric_current:     A
        energy:               J
        length:               m
        luminous_intensity:   cd
        mass:                 kg
        pressure:             Pa
        quantity:             mol
        solid_angle:          sr
        temperature:          K
        uom_time:             s
        velocity:             m/s
        volume:               m^3

Note that this is optional and the defaults above will be used otherwise.

Use

This module allows you to use native PhysicalQuantity types in Doctrine and on forms.

Doctrine Use

class Person
{
    // [...]
    /**
     * @ORM\Column(type="length")
     * @var Length
     */
    private $height;
    // [...]
}

Form Use

$form = $this->createFormBuilder()
    ->add('length', LengthType::class)
    ->add('mass', MassType::class)
    ->add('save', SubmitType::class, array('label' => 'Create Post'))
    ->getForm();

About

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub.

Author

Luke Bainbridge - http://twitter.com/midnightLuke

License

PHP Units Of Measure Bundle is licensed under the MIT License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固