PHPackages                             strakez/entity-decorator-api - 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. strakez/entity-decorator-api

ActiveDrupal-module[Utility &amp; Helpers](/categories/utility)

strakez/entity-decorator-api
============================

Implements a decorator pattern to access and customize typed access to an entity's properties and methods

1.x-dev(2y ago)018GPL-2.0-or-laterPHPPHP &gt;=8.1

Since Dec 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/strakers/drupal-entity-decorator)[ Packagist](https://packagist.org/packages/strakez/entity-decorator-api)[ RSS](/packages/strakez-entity-decorator-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (9)Used By (0)

Drupal Entity Decorator API
===========================

[](#drupal-entity-decorator-api)

Implements a decorator pattern to access and customize an entity's properties and methods, with the option to strongly type return values.

---

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

[](#installation)

```
composer require strakez/drupal-entity-decorator
```

---

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

[](#requirements)

- PHP 8.1+
- Drupal 10+

---

Purpose
-------

[](#purpose)

Provides a simple means to retrieve and display entity data, and solves some of the challenges experienced when working with entities. This implementation of the decorator pattern wraps the entity and provides customized methods for interacting with the entity.

Please note, this only exposes classes for use in other modules and does not provide any Drupal functionality on its own. There will not be anything to display via the UI unless specifically implemented.

---

Usage
-----

[](#usage)

```
$id = 1;
$node = NodeDecorator::load($id); // Collection

$node->id(); // 1
$node->get('title'); // 'My First Node'
$node->get('sticky'); // false
```

For information on using and extending decorators, see the [Decorator documentation](docs/Decorators.md).

For tips and best practices, see the [Tips &amp; Best Practices](docs/BestPractices.md) section.

---

Working with Collections
------------------------

[](#working-with-collections)

When loading multiple decorators at a time, the data will be representated in a collection. This provides an advantage over simple arrays, as this data can be easily sorted, mutated, counted, and indexed.

```
$set = NodeDecorator::loadByOwned($user); // Collection
```

For more information, see the [Collection documentation](docs/Collections.md).

Final Words
-----------

[](#final-words)

Please have fun using this API, and feel free to submit your comments and/or improvements if you find any. Thanks!

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Total

3

Last Release

844d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/59b0a077d0480dab9845c7b276c45c7fbe19d03c3ad37351162c11cd2f7befe7?d=identicon)[strakers](/maintainers/strakers)

---

Top Contributors

[![strakers](https://avatars.githubusercontent.com/u/6682857?v=4)](https://github.com/strakers "strakers (117 commits)")

---

Tags

drupalentityphp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/strakez-entity-decorator-api/health.svg)

```
[![Health](https://phpackages.com/badges/strakez-entity-decorator-api/health.svg)](https://phpackages.com/packages/strakez-entity-decorator-api)
```

###  Alternatives

[mage-os/mageos-async-events

An event-driven flexible async events module that allows you to process any event asynchronously.

3018.7k5](/packages/mage-os-mageos-async-events)

PHPackages © 2026

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