isimmons/weight-conversions

Weight conversions in PHP

1.1.1 2024-05-16 19:32 UTC

This package is auto-updated.

Last update: 2024-10-28 17:43:02 UTC


README

Latest Version on Packagist Tests Total Downloads

Convert any number of units in grams or kilograms to pounds or stones

Installation

You can install the package via composer:

composer require isimmons/weight-conversions

Basic Usage

use Isimmons\WeightConversions\Weight;

include 'vendor/autoload.php';

$amount = 100;
$pounds_from_grams = Weight::grams($amount)->toPounds();

$pounds_from_kilograms = Weight::kilograms($amount)->toPounds();

echo "$amount grams = $pounds_from_grams pounds." . PHP_EOL;
echo "$amount kilograms = $pounds_from_kilograms pounds.\n" . PHP_EOL;

Available Methods

  • toPounds
  • toStones

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.