2017 © Pedro Peláez
 

symfony-bundle php-units-of-measure-bundle

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

image

midnightluke/php-units-of-measure-bundle

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

  • Tuesday, June 26, 2018
  • by midnightLuke
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 4 Open issues
  • 8 Versions
  • 33 % Grown

The README.md

PHP Units Of Measure Bundle

Build Status Coverage Status, (*1)

Provides useful Doctrine and Form types for working with the PHP Units of Measure Library., (*2)

Installation

Install this bundle using composer:, (*3)

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

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

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

Add the form types you need to doctrine in config.yml:, (*5)

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:, (*6)

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., (*7)

Use

This module allows you to use native PhysicalQuantity types in Doctrine and on forms., (*8)

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., (*9)

Author

Luke Bainbridge - http://twitter.com/midnightLuke, (*10)

License

PHP Units Of Measure Bundle is licensed under the MIT License - see the LICENSE file for details., (*11)

The Versions

26/06 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Bainbridge

26/06 2018

1.0.0-alpha5

1.0.0.0-alpha5

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Bainbridge

02/05 2018

1.0.0-alpha4

1.0.0.0-alpha4

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Bainbridge

23/09 2017

1.0.0-alpha3

1.0.0.0-alpha3

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Bainbridge

23/09 2017

dev-8-form-block-prefixes

dev-8-form-block-prefixes

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Bainbridge

23/09 2017

dev-7-remove-doctrine-auto-registration

dev-7-remove-doctrine-auto-registration

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Bainbridge

14/06 2017

1.0.0-alpha2

1.0.0.0-alpha2

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Bainbridge

06/06 2017

1.0.0-alpha1

1.0.0.0-alpha1

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Bainbridge