triplepoint / php-units-of-measure-bundle
Symfony PhpUnitsOfMeasureBundle
Installs: 114
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- symfony/framework-bundle: 2.*
- triplepoint/php-units-of-measure: 1.3.1
This package is auto-updated.
Last update: 2024-10-16 19:03:55 UTC
README
The PhpUnitsOfMeasureBundle
provides integration of the php-units-of-measure library into the Symfony2 framework.
Features:
Twig filter list
um_acceleration
um_angle
um_area
um_electric_current
um_length
um_luminous_intensity
um_mass
um_pressure
um_temperature
um_velocity
um_volume
Installation and configuration:
Add PhpUnitsOfMeasureBundle to your application kernel
<?php // app/AppKernel.php public function registerBundles() { return array( // ... new Triplepoint\PhpUnitsOfMeasureBundle\TriplepointPhpUnitsOfMeasureBundle(), // ... ); }
Usage examples:
Twig extensions examples
Convert filters :
-
{{ '5000' | um_length('m', 'km') }}
convert 5000 meters to 5 kilometers -
{{ '0.5' | um_acceleration }}
convert 0.5 m/s2 to 6480 km/h2 using the default units
Future work:
- Allow overriding measure classes