This module provides an API for storing and manipulating physical measurements. It also supports unit conversions.
Features
Supported measurement types:
- Area
- Length
- Temperature
- Volume
- Weight
Provided field types:
- Physical measurement: Stores a single measurement and its unit.
- Physical dimensions: Stores the length/width/height measurements and their unit.
Other features:
- Language-specific number input and formatting
- Value objects with support for bcmath-based arithmetic.
Drupal 9 & 10 & 11
Installation
Physical should only be installed via Composer. The zip files on this page are provided for informative purposes only.
Drupal 9 or newer is required.
Example:
use Drupal\physical\Weight;
use Drupal\physical\WeightUnit;
$weight = new Weight('100', WeightUnit::KILOGRAM);
$other_weight = new Weight('120', WeightUnit::KILOGRAM);
// Add the two weights together then express them in pounds.
$new_weight = $weight->add($other_weight)->convert(WeightUnit::POUND);
Incompatibility notes
Physical 1.3+ is incompatible with Commerce versions prior to 2.34 (See https://www.drupal.org/project/physical/issues/3345698#comment-15019339).
Supporting organizations:
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.Maintenance fixes only
Considered feature-complete by its maintainers.- Project categories: E-commerce, Site structure
13,494 sites report using this module
- Created by rszrama on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
8.x-1.5
released 29 October 2024
Works with Drupal: ^9 || ^10 || ^11
Install:
Development version: 8.x-1.x-dev updated 29 Oct 2024 at 11:18 UTC




