PHPackages                             drupol/dynamicobjects - 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. drupol/dynamicobjects

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

drupol/dynamicobjects
=====================

Create and manage dynamic properties and methods on a PHP object.

1.4.3(6y ago)1517711MITPHPPHP &gt;= 5.6

Since Sep 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/loophp/dynamicobjects)[ Packagist](https://packagist.org/packages/drupol/dynamicobjects)[ Docs](https://github.com/drupol/dynamicobjects)[ RSS](/packages/drupol-dynamicobjects/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (19)Used By (1)

[![Build Status](https://camo.githubusercontent.com/c3c29d3e7c5fbc3b21971dedaff2c99b462f8d96f518c74a893f2c11d95d4c0a/68747470733a2f2f7777772e7472617669732d63692e6f72672f647275706f6c2f64796e616d69636f626a656374732e7376673f6272616e63683d6d6173746572)](https://www.travis-ci.org/drupol/dynamicobjects)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b16dbdd50c232e957459f790938c267a6337106e761b2a7432525ddb73b7a1ad/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f647275706f6c2f64796e616d69636f626a656374732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/drupol/dynamicobjects/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/be62d91b2b96b458ec02849018e4582730c956e19920d72230d99669b0bc7afa/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f647275706f6c2f64796e616d69636f626a656374732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/drupol/dynamicobjects/?branch=master)[![StyleCI](https://camo.githubusercontent.com/c2e0190b8f6a0154760569022054f58c0cbe9cf7b2c899b124e8153078a3aae3/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130333738373037352f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/103787075)[![Latest Stable Version](https://camo.githubusercontent.com/6f8325869faf87a031962303fbdc235c29b253c636449fd2c26aa59f8d793143/68747470733a2f2f706f7365722e707567782e6f72672f647275706f6c2f64796e616d69636f626a656374732f762f737461626c65)](https://packagist.org/packages/drupol/dynamicobjects)[![Total Downloads](https://camo.githubusercontent.com/5360fb984a11bfe4b0e684c27f17d3773b4536cee32756da05e990c950467cc0/68747470733a2f2f706f7365722e707567782e6f72672f647275706f6c2f64796e616d69636f626a656374732f646f776e6c6f616473)](https://packagist.org/packages/drupol/dynamicobjects)[![License](https://camo.githubusercontent.com/5b78e3e8fd14eeff21c6261be55a40e163d43caa0e81a0d5f12ea95125ad1696/68747470733a2f2f706f7365722e707567782e6f72672f647275706f6c2f64796e616d69636f626a656374732f6c6963656e7365)](https://packagist.org/packages/drupol/dynamicobjects)

DynamicObjects
==============

[](#dynamicobjects)

Description
-----------

[](#description)

Create and manage dynamic properties and methods on a PHP object.

Features
--------

[](#features)

- Allows you to add regular or static methods and properties to an existing object,
- Can be used by extending the DynamicObject object or as a trait, on a real or anonymous class,
- Can memoize methods results and/or properties if they are callable,
- The caching object use CacheInterface and can be injected.

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

[](#requirements)

- PHP &gt;= 5.6

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

[](#installation)

`composer require drupol/dynamicobjects`

Optional
--------

[](#optional)

To enable memoization you will need an extra package.

`composer require drupol/memoize`

Usage
-----

[](#usage)

Using the object:

```
