PHPackages                             row-bloom/css-length - 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. row-bloom/css-length

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

row-bloom/css-length
====================

Standard CSS sizing

v0.5.0(2y ago)121MITPHPPHP ^8.1

Since Dec 30Pushed 2y agoCompare

[ Source](https://github.com/row-bloom/css-length)[ Packagist](https://packagist.org/packages/row-bloom/css-length)[ Docs](https://github.com/row-bloom/css-length)[ RSS](/packages/row-bloom-css-length/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (5)Used By (0)

CSS Sizing
==========

[](#css-sizing)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0b231ec411f44fc68c752a4c04284a0497b95cf91df08fca6bddd265151f018c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f772d626c6f6f6d2f6373732d6c656e6774682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/row-bloom/css-length)[![Total Downloads](https://camo.githubusercontent.com/7ee1935547a7ddfe49c4fa3c9c88c16f38f67fef6b6b76448ba2a3889e8f693f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f772d626c6f6f6d2f6373732d6c656e6774682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/row-bloom/css-length)[![Pest Action](https://camo.githubusercontent.com/312706d51727b54528f9ca53b426cfeec72dc8147f58ad6406ca5f286c43c74a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f772d626c6f6f6d2f726f772d626c6f6f6d2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/row-bloom/row-bloom/actions?query=workflow%3Arun-tests+branch%3Amain)[![Pint action](https://camo.githubusercontent.com/10703f2f82b618432d0081c07fc9394555a1f03cdaa5c03a09d3d4ba4886c7e4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f772d626c6f6f6d2f726f772d626c6f6f6d2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/row-bloom/row-bloom/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)

Value objects and enums to manipulate CSS lengths and ensure valid values in your PHP code.

Important

This is a sub-split, for development, pull requests and issues, visit:

This package adheres to the [CSS Values and Units Module Level 3 Candidate Recommendation](https://www.w3.org/TR/css-values-3/#lengths), particularly focusing on length values. It also encompasses related elements like standard paper sizes and facets of the box model, providing cohesive support for length applications.

Notably, it proves particularly beneficial for tasks involving PDF generation from HTML.

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

[](#installation)

```
composer require row-bloom/css-length
```

Requirements
------------

[](#requirements)

- PHP 8.1

Usage
-----

[](#usage)

### LengthUnit enum

[](#lengthunit-enum)

- An enum of absolute and relative length units.
- Absolute units are `px`, `pc`, `pt`, `mm`, `cm`, `in`.
- Relative units (todo).
- Provides absolute units equivalence using `absoluteUnitsEquivalence` static method.

### Length object

[](#length-object)

- Create value object by parsing a dimension string or providing a pair of value and unit.

### BoxArea object

[](#boxarea-object)

- Value object for representing Padding areas, Margin areas, and border areas.
- Create and object by providing a valid CSS value string.
- Access value of each of the for sides (`top`, `right`, `bottom`, `left`).

### BoxSize object

[](#boxsize-object)

Encompasses a pair of width and height.

### PaperFormat enum

[](#paperformat-enum)

- ISO 216:2007 `A0`, `A1`, `A2`, `A3`, `A4`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `B0`, `B1`, `B2`, `B3`, `B4`, `B5`, `B6`, `B7`, `B8`, `B9`, `B10`.
- ISO 269:1985 `C0`, `C1`, `C2`, `C3`, `C4`, `C5`, `C6`, `C7`, `C8`, `C9`, `C10`.
- ASME Y14.1-2020 US Paper Sizes `LETTER`, `LEGAL`, `LEDGER`, `TABLOID`.

> Precede any official paper format name with an underscore to get the enum case.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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 ~0 days

Total

4

Last Release

867d ago

### Community

Maintainers

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

---

Top Contributors

[![medilies](https://avatars.githubusercontent.com/u/35309918?v=4)](https://github.com/medilies "medilies (1 commits)")

---

Tags

css3cssSizing

### Embed Badge

![Health badge](/badges/row-bloom-css-length/health.svg)

```
[![Health](https://phpackages.com/badges/row-bloom-css-length/health.svg)](https://phpackages.com/packages/row-bloom-css-length)
```

###  Alternatives

[components/flag-icon-css

A curated collection of all country flags in SVG — plus the CSS for easier integration.

12.0k1.6M23](/packages/components-flag-icon-css)[matthiasmullie/minify

CSS &amp; JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

2.0k30.5M336](/packages/matthiasmullie-minify)[scssphp/scssphp

scssphp is a compiler for SCSS written in PHP.

62827.7M220](/packages/scssphp-scssphp)[mexitek/phpcolors

A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly.

5003.6M18](/packages/mexitek-phpcolors)[wikimedia/less.php

PHP port of the LESS processor

12327.4M77](/packages/wikimedia-lessphp)[cerdic/css-tidy

CSSTidy is a CSS minifier

2092.0M6](/packages/cerdic-css-tidy)

PHPackages © 2026

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