PHPackages                             jeffwhansen/distance-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. jeffwhansen/distance-conversions

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

jeffwhansen/distance-conversions
================================

Distance conversions in PHP

1.1.4(2y ago)03.3k↓20%[1 PRs](https://github.com/jeffwhansen/distance-conversions/pulls)MITPHPPHP ^8.1

Since Jul 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/jeffwhansen/distance-conversions)[ Packagist](https://packagist.org/packages/jeffwhansen/distance-conversions)[ Docs](https://github.com/jeffwhansen/distance-conversions)[ GitHub Sponsors](https://github.com/jeffwhansen)[ RSS](/packages/jeffwhansen-distance-conversions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (8)Used By (0)

Distance conversions in PHP
===========================

[](#distance-conversions-in-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/26c32208c7ac0ee183a7d988b10244be9a128061913b4221ee6f14c3dab3a433/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6566667768616e73656e2f64697374616e63652d636f6e76657273696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffwhansen/distance-conversions)[![Tests](https://github.com/jeffwhansen/distance-conversions/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/jeffwhansen/distance-conversions/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/de29d300cb765792ac4115a8d98850e6eb287ebe5d8454463ac871a8ea0acafe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6566667768616e73656e2f64697374616e63652d636f6e76657273696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffwhansen/distance-conversions)

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

[](#installation)

You can install the package via composer:

```
composer require jeffwhansen/distance-conversions
```

Usage
-----

[](#usage)

```
Distance::fromMeters("5.55")->to(Format::ENGLISH); //18-2.5
Distance::fromFeet("18-2.5")->to(Format::METRIC); //5.55
Distance::fromFeet("18-2.5")->to("M.C"); //5.55
Distance::fromMeters("5.55")->to("F' I-i\""); //18' 2-1/2"
```

### Format String Constants

[](#format-string-constants)

You can format your output using the following placeholders. Any character you provide that is in not in the list will be literally printed in the response.

```
const M = "Meters"; // 5
const C = "Centimeters"; // 55
const F = "Feet"; // 18
const I = "Inches"; //0-11
const p = "Inches partial as decimal"; //.25
const i = "Inches partial as fraction"; // 1/4

```

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 Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Jeff Hansen](https://github.com/jeffwhansen)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 58.8% 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 ~110 days

Recently: every ~138 days

Total

6

Last Release

849d ago

### Community

Maintainers

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

---

Top Contributors

[![jeffwhansen](https://avatars.githubusercontent.com/u/2449767?v=4)](https://github.com/jeffwhansen "jeffwhansen (20 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")

---

Tags

conversionsdistancephpjeffwhansendistance-conversions

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/jeffwhansen-distance-conversions/health.svg)

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

###  Alternatives

[wpbp/generator

Generator of Wordpress Plugin Boilerplate Powered

832.3k](/packages/wpbp-generator)

PHPackages © 2026

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