PHPackages                             survos/shape-contracts - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. survos/shape-contracts

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

survos/shape-contracts
======================

Shared value objects for physical shape, dimensions, and measurement units.

2.10.19(1mo ago)077↑100%1MITPHPPHP ^8.5

Since May 28Pushed 1mo agoCompare

[ Source](https://github.com/survos/shape-contracts)[ Packagist](https://packagist.org/packages/survos/shape-contracts)[ GitHub Sponsors](https://github.com/kbond)[ RSS](/packages/survos-shape-contracts/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (60)Used By (1)

survos/shape-contracts
======================

[](#survosshape-contracts)

Shared PHP value objects for physical shape and dimensions.

This package is deliberately framework-free. It defines the stable payload that importers, DTO contracts, folio browsing, Symfony bundles, Doctrine storage, parsers, and UI renderers can agree on.

Scope
-----

[](#scope)

`shape-contracts` owns:

- unit identifiers and conversion to millimeters
- immutable single-axis lengths
- immutable physical shape values with nullable axes
- normalized array round-tripping for JSON/DTO payloads

It does not own Symfony services, Doctrine mapping, Twig filters, form types, icons, or free-text parsing. Those belong in `survos/shape-bundle` or `survos/dimensions-bundle`.

Example
-------

[](#example)

```
use Survos\ShapeContracts\Length;
use Survos\ShapeContracts\Shape;
use Survos\ShapeContracts\Unit;

$shape = new Shape(
    width: Length::from(18, Unit::CM),
    height: Length::from(22, Unit::CM),
    source: '18 x 22 cm',
);

$shape->toNormalizedArray();
// [
//   'widthMm' => 180,
//   'heightMm' => 220,
//   'depthMm' => null,
//   'lengthMm' => null,
//   'thicknessMm' => null,
//   'diameterMm' => null,
//   'label' => null,
//   'source' => '18 x 22 cm',
// ]
```

Normalized JSON shape
---------------------

[](#normalized-json-shape)

Use camel-case millimeter keys so JSON can be copied directly into DTO data:

```
{
  "widthMm": 180,
  "heightMm": 220,
  "depthMm": null,
  "lengthMm": null,
  "thicknessMm": null,
  "diameterMm": null,
  "label": null,
  "source": "18 x 22 cm"
}
```

The original source/display string should remain in the museum `dimensions` field when available. The structured shape is a companion field for consistent storage, querying, and rendering.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance92

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

59

Last Release

45d ago

PHP version history (2 changes)2.7.13PHP ^8.4

2.9.3PHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/21b39551f92ed4143772c622f9e571589c5a72c96ab3c53fe67489ce0d83e806?d=identicon)[tacman1123](/maintainers/tacman1123)

---

Top Contributors

[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (2 commits)")

###  Code Quality

TestsPHPUnit

Code StyleECS

### Embed Badge

![Health badge](/badges/survos-shape-contracts/health.svg)

```
[![Health](https://phpackages.com/badges/survos-shape-contracts/health.svg)](https://phpackages.com/packages/survos-shape-contracts)
```

###  Alternatives

[maclof/kubernetes-client

A simple yet elegant client for accessing and controlling a Kubernetes cluster.

234916.9k5](/packages/maclof-kubernetes-client)

PHPackages © 2026

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