PHPackages                             dealnews/typed-objects - 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. dealnews/typed-objects

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

dealnews/typed-objects
======================

Base classes for creating objects with typed/constrained properties

v1.1.0(6y ago)2201BSD-3-ClausePHPPHP &gt;=7.1.0CI failing

Since Mar 10Pushed 3mo ago7 watchersCompare

[ Source](https://github.com/dealnews/typed-objects)[ Packagist](https://packagist.org/packages/dealnews/typed-objects)[ RSS](/packages/dealnews-typed-objects/feed)WikiDiscussions master Synced 2mo ago

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

DEPRECATED
==========

[](#deprecated)

PHP now supports typed properties. We suggest using [moonspot/value-objects](https://github.com/brianlmoon/value-objects) in place of this library.

PHP Objects with typed/constrained properties
=============================================

[](#php-objects-with-typedconstrained-properties)

A library for creating PHP objects with typed properties.

It supports all of the types that are supported by [dealnews/constraints](https://github.com/dealnews/constraints).

Object with Typed Properties Example
------------------------------------

[](#object-with-typed-properties-example)

```
// A very simple example
class Foo extends \DealNews\TypedObjects\TypedProperty {
    protected $id;
    protected $name;

    const CONSTRAINTS = [
        "id" => [
            "type" => "integer"
        ],
        "name" => [
            "type" => "string"
        ],
    ];
}

$foo = new Foo();
$foo->id = "1"; // will be integer 1
$foo->id = "string"; // will throw an exception
```

Typed Array Example
-------------------

[](#typed-array-example)

```
class FooSet extends \DealNews\TypedObjects\TypedArray {
    const REQUIRED_TYPE = "Foo";
}

$set = new FooSet();
$set[] = new Foo(); // allowed
$set[] = 1; // Throws an exception
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance54

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

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

Total

2

Last Release

2506d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49531?v=4)[Brian Moon](/maintainers/brianlmoon)[@brianlmoon](https://github.com/brianlmoon)

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dealnews-typed-objects/health.svg)

```
[![Health](https://phpackages.com/badges/dealnews-typed-objects/health.svg)](https://phpackages.com/packages/dealnews-typed-objects)
```

###  Alternatives

[h5p/h5p-editor

H5P Editor functionality in PHP

761.5M29](/packages/h5p-h5p-editor)[petrgrishin/array-map

The object oriented approach to working with arrays on PHP

125.8k1](/packages/petrgrishin-array-map)

PHPackages © 2026

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