PHPackages                             fabyo0/weight-conversion - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fabyo0/weight-conversion

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fabyo0/weight-conversion
========================

A simple and flexible weight conversion package for PHP

v1.1.0(4mo ago)12[3 PRs](https://github.com/fabyo0/weight-conversion/pulls)MITPHPPHP ^8.2CI passing

Since Dec 22Pushed 1mo agoCompare

[ Source](https://github.com/fabyo0/weight-conversion)[ Packagist](https://packagist.org/packages/fabyo0/weight-conversion)[ Docs](https://github.com/fabyo0/weight-conversion)[ GitHub Sponsors](https://github.com/Fabyo)[ RSS](/packages/fabyo0-weight-conversion/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (6)Used By (0)

Weight Conversion
=================

[](#weight-conversion)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a975954c6230988c3b7beb04e8e6e84522834afa98e0f3bc16025756d8f3aa0f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666162796f302f7765696768742d636f6e76657273696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fabyo0/weight-conversion)[![Tests](https://camo.githubusercontent.com/48e4c38304aa27a30199717a6cc5fcd8b5c0731ea8d96cf753e215bf2617193d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f666162796f302f7765696768742d636f6e76657273696f6e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/fabyo0/weight-conversion/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/f88876bc2092544c01de5436d29abe4dc65de301ec7c66934eb57ab581aad336/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666162796f302f7765696768742d636f6e76657273696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fabyo0/weight-conversion)

A simple and flexible weight conversion package for PHP. Convert between kilograms, grams, pounds, ounces and more with ease.

> **Note:** This package was developed as a learning project, following the [Spatie Laravel Package Training](https://laravelpackage.training) course as a reference.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require fabyo0/weight-conversion
```

Usage
-----

[](#usage)

```
use Fabyo0\WeightConversion\WeightConversion;

// Static factory methods
$weight = WeightConversion::fromKilograms(100);
$weight = WeightConversion::fromPounds(220);

// Method chaining
$total = WeightConversion::fromKilograms(50)
    ->add(25, 'kg')
    ->subtract(10, 'lb')
    ->toKilograms();

// Comparison methods
$weight1 = WeightConversion::fromKilograms(100);
$weight2 = WeightConversion::fromPounds(220);

$weight1->isGreaterThan($weight2); // true/false

// Formatting output
$weight = new WeightConversion(75.5, 'kg');
echo $weight->format(2); // "75.50 kg"

// Get supported units
WeightConversion::getSupportedUnits(); // ['kg', 'g', 'mg', 'lb', 'oz', 't']
```

Supported Units
---------------

[](#supported-units)

UnitSymbolKilogramkgGramgMilligrammgPoundlbOunceozTon (Metric)tTesting
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability, please send an email to .

Credits
-------

[](#credits)

- [Emre Dikmen](https://github.com/fabyo0)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance84

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

138d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d648ee1d4e744ae2b8454074f78f0a91a727488844243a22fcf01fb3e62242b8?d=identicon)[fabyo0](/maintainers/fabyo0)

---

Top Contributors

[![fabyo0](https://avatars.githubusercontent.com/u/101067129?v=4)](https://github.com/fabyo0 "fabyo0 (23 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

converterweightunit-conversiongramweight-conversionkilogrampound

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/fabyo0-weight-conversion/health.svg)

```
[![Health](https://phpackages.com/badges/fabyo0-weight-conversion/health.svg)](https://phpackages.com/packages/fabyo0-weight-conversion)
```

###  Alternatives

[mark-gerarts/auto-mapper-plus

An AutoMapper for PHP

5623.2M21](/packages/mark-gerarts-auto-mapper-plus)[iamcal/php-emoji

This is a PHP library for dealing with Emoji, allowing you to convert between various native formats and displaying them using HTML.

1.3k481.1k](/packages/iamcal-php-emoji)[matthiasmullie/path-converter

Relative path converter

10229.6M7](/packages/matthiasmullie-path-converter)[ncjoes/office-converter

PHP Wrapper for LibreOffice

2431.2M4](/packages/ncjoes-office-converter)[henck/rtf-to-html

RTF to HTML converter in PHP

108785.6k1](/packages/henck-rtf-to-html)[cartalyst/converter

A framework agnostic measurement conversion and formatting package featuring multiple types of measurements and currency conversion.

88434.4k7](/packages/cartalyst-converter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
