Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Physical Fields

Security covered Maintenance fixes only 13,362 sites

This module provides a system for storing and converting physical measurements like length, weight, and temperature. It includes field types for single measurements and dimensions, with support for language-specific formatting and precise arithmetic.

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).

Drupal 9–11

Ask your assistant about Physical Fields

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • field Drupal core

Required by

4 tracked projects depend on this one

Activity

Tracked releases
3
Tracked since
Mar 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
8.x-1.5 Stable 9–11 Oct 29, 2024
8.x-1.4 Stable 9–11 PHP ^8.0 Jul 23, 2024
8.x-1.3 Stable 9–10 PHP ^8.0 Mar 30, 2023