PHPackages                             spatie/unit-conversions - 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. spatie/unit-conversions

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

spatie/unit-conversions
=======================

Perform unit conversions in PHP

1.2.0(6y ago)343.5k12MITPHPPHP ^7.4CI passing

Since May 10Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/spatie/unit-conversions)[ Packagist](https://packagist.org/packages/spatie/unit-conversions)[ Docs](https://github.com/spatie/unit-conversions)[ RSS](/packages/spatie-unit-conversions/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Perform unit conversions in PHP
===============================

[](#perform-unit-conversions-in-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/05c616895a30c02cd8c673af47863ba9def02bdf2266e54f0f7cd216a8103b97/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f756e69742d636f6e76657273696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/unit-conversions)[![GitHub Tests Action Status](https://camo.githubusercontent.com/e2f0b2539c952bcdf31597fa9d400e02c7bdfc622d164565e37505a8d1ae728f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f756e69742d636f6e76657273696f6e732f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/spatie/unit-conversions/actions?query=workflow%3Arun-tests+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/ced566e3e464b83808134fef50cbfba9022214f8ea272d11d1651c3543a26d68/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f756e69742d636f6e76657273696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/unit-conversions)

This package can perform various unit conversions. Right now, only kg to lbs is supported.

Here's how to use it:

```
use Spatie\UnitConversions\Weight;

Weight::fromKilograms(100)->toLbs(); // returns 220.4623;
```

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/ddebc88adda541c4b8f7d7c4d4e0a416f12749e02ee7ce7c367376d0f58ba441/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f756e69742d636f6e76657273696f6e732e6a70673f743d31)](https://spatie.be/github-ad-click/unit-conversions)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require spatie/unit-conversions
```

Usage
-----

[](#usage)

#### From kg to lbs

[](#from-kg-to-lbs)

```
Spatie\UnitConversions\Weight::fromKilograms(100)->toLbs(); // returns 220.4623;
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance54

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56% 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 ~3 days

Total

4

Last Release

2190d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (28 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (7 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (5 commits)")[![alexmanase](https://avatars.githubusercontent.com/u/10696975?v=4)](https://github.com/alexmanase "alexmanase (4 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (3 commits)")[![rodelias-frete](https://avatars.githubusercontent.com/u/281798633?v=4)](https://github.com/rodelias-frete "rodelias-frete (1 commits)")[![MattStrauss](https://avatars.githubusercontent.com/u/15204019?v=4)](https://github.com/MattStrauss "MattStrauss (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

spatieunit-conversions

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/spatie-unit-conversions/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-unit-conversions/health.svg)](https://phpackages.com/packages/spatie-unit-conversions)
```

###  Alternatives

[spatie/laravel-package-tools

Tools for creating Laravel packages

945125.5M7.0k](/packages/spatie-laravel-package-tools)[spatie/laravel-data

Create unified resources and data transfer objects

1.8k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-analytics

A Laravel package to retrieve Google Analytics data.

3.2k5.7M57](/packages/spatie-laravel-analytics)[spatie/macroable

A trait to dynamically add methods to a class

72759.6M64](/packages/spatie-macroable)[spatie/regex

A sane interface for php's built in preg\_\* functions

1.1k17.1M59](/packages/spatie-regex)[spatie/enum

PHP Enums

84529.1M68](/packages/spatie-enum)

PHPackages © 2026

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