PHPackages                             php-value-object/temperature - 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. php-value-object/temperature

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

php-value-object/temperature
============================

Temperature ValueObject for PHP. Easy to use with implementation of Kelvin, Celsius and Fahrenheit

v0.2(8y ago)2221MITPHPPHP &gt;=7.0

Since Dec 7Pushed 8y ago4 watchersCompare

[ Source](https://github.com/PHPValueObject/Temperature)[ Packagist](https://packagist.org/packages/php-value-object/temperature)[ RSS](/packages/php-value-object-temperature/feed)WikiDiscussions master Synced 5d ago

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

Temperature Value Objects
=========================

[](#temperature-value-objects)

[![Build Status](https://camo.githubusercontent.com/45afcb2e6be8f734d2a935ac4efe622c200f117d5f1a9fd95128539dac8df6c1/68747470733a2f2f7472617669732d63692e6f72672f50485056616c75654f626a6563742f54656d70657261747572652e737667)](https://travis-ci.org/PHPValueObject/Temperature)[![Latest Stable Version](https://camo.githubusercontent.com/540b395c722c8ac227fea37f8ba92cf6664c134f64e4cd953fadee72de95d8bd/68747470733a2f2f706f7365722e707567782e6f72672f7068702d76616c75652d6f626a6563742f74656d70657261747572652f762f737461626c65)](https://packagist.org/packages/php-value-object/temperature)[![License](https://camo.githubusercontent.com/1f6bf182411394ed1654c32c260cc24352f1505aecb406dbdfc999d269e8376d/68747470733a2f2f706f7365722e707567782e6f72672f7068702d76616c75652d6f626a6563742f74656d70657261747572652f6c6963656e7365)](https://packagist.org/packages/php-value-object/temperature)[![PHPStan](https://camo.githubusercontent.com/441b5874ce4df0a2defc892979c96c46889b69cb32119d04f0b48626349f8bc9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/phpvalueobject/temperature)

This repository provides Temperature ValueObject implementation for PHP that is easy to use and easily allow your classes to depend on `Temperature` object instead of just float or string.

Install
-------

[](#install)

You can install this package via composer

`composer require php-value-object/temperature`

Example
-------

[](#example)

```
function isItWarm(Temperature $temperature) : bool
{
    $hot = new Celsius(23);
    if($temperature->gte($hot)) {
      return true; // t-shirt time
    }

    return false; // jacket time
}

$temperature = new Kelvin(0);
isItWarm($temperature); // false
```

Usage
-----

[](#usage)

The temperature classes are supported: `Celsius`, `Fahrenheit` and `Kelvin`.

It is possible to compare them via helper methods:

- `eq` - equals
- `gt` - greater than
- `gte` - greater than or equals
- `lt` - less than
- `lte` - less than or equals
- `compareTo` - returns -1, 0, 1 if less than, equal or greater than

To introduce new temperature class simply extend Temperature.

Licence
-------

[](#licence)

MIT

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

[](#contributing)

Any contributions are welcome

Building &amp; Development
--------------------------

[](#building--development)

The easiest way how to develop is to `git clone` and run `make`

```
git clone git@github.com:PHPValueObject/Temperature.git temperature
cd temperature
make

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~60 days

Total

2

Last Release

3022d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/743421?v=4)[Martin Hlavac](/maintainers/mhlavac)[@mhlavac](https://github.com/mhlavac)

---

Top Contributors

[![mhlavac](https://avatars.githubusercontent.com/u/743421?v=4)](https://github.com/mhlavac "mhlavac (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-value-object-temperature/health.svg)

```
[![Health](https://phpackages.com/badges/php-value-object-temperature/health.svg)](https://phpackages.com/packages/php-value-object-temperature)
```

###  Alternatives

[spatie/laravel-cookie-consent

Make your Laravel app comply with the crazy EU cookie law

1.5k4.7M20](/packages/spatie-laravel-cookie-consent)[async-aws/async-aws-bundle

Configure all your AsyncAws services and enjoy the autowire greatness.

243.6M2](/packages/async-aws-async-aws-bundle)[sheadawson/silverstripe-rateable

An extension that adds a star rating system + UI to any DataObject type.

204.6k1](/packages/sheadawson-silverstripe-rateable)

PHPackages © 2026

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