PHPackages                             arraypress/wp-object-utils - 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. arraypress/wp-object-utils

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

arraypress/wp-object-utils
==========================

Minimal, memorable object manipulation utilities for WordPress and PHP projects.

110PHP

Since Nov 22Pushed 7mo agoCompare

[ Source](https://github.com/arraypress/wp-object-utils)[ Packagist](https://packagist.org/packages/arraypress/wp-object-utils)[ RSS](/packages/arraypress-wp-object-utils/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress Object Utilities
==========================

[](#wordpress-object-utilities)

Minimal, memorable object manipulation utilities for everyday PHP development. Just 5 methods you'll actually use and remember.

Features
--------

[](#features)

- 🎯 **Focused**: Only the most useful object operations
- 🧠 **Memorable**: Simple method names you'll remember months later
- 📝 **Change Tracking**: Compare objects with new data
- 🔍 **Dot Notation**: Access nested properties easily
- 🎨 **Clean API**: Intuitive, consistent interface

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

[](#installation)

```
composer require arraypress/wp-object-utils
```

Quick Start
-----------

[](#quick-start)

```
use ArrayPress\ObjectUtils\Obj;

// Track what changed
$changes = Obj::changes( $user, $_POST );

// Apply updates
Obj::apply( $user, $changes );

// Get nested values
$city = Obj::get( $user, 'address.city', 'Unknown' );

// Extract subset
$public = Obj::pick( $user, [ 'name', 'email' ] );

// Convert to array
$array = Obj::to_array( $user );
```

Methods
-------

[](#methods)

### changes()

[](#changes)

Compare an object with new data and get what changed:

```
$user    = (object) [ 'name' => 'John', 'email' => 'john@example.com' ];
$changes = Obj::changes( $user, [ 'name' => 'John', 'email' => 'new@example.com' ] );
// Returns: ['email' => 'new@example.com']
```

### apply()

[](#apply)

Apply changes to an object (only updates existing properties):

```
$count = Obj::apply( $user, [ 'name' => 'Jane', 'email' => 'jane@example.com' ] );
// Returns: 2 (number of properties updated)
```

### get()

[](#get)

Get nested values using dot notation:

```
$data = (object) [ 'user' => (object) [ 'address' => [ 'city' => 'NYC' ] ] ];
$city = Obj::get( $data, 'user.address.city' );
// Returns: 'NYC'
```

### pick()

[](#pick)

Extract specific properties:

```
$user   = (object) [ 'id' => 1, 'name' => 'John', 'password' => 'secret' ];
$public = Obj::pick( $user, [ 'id', 'name' ] );
// Returns: (object) ['id' => 1, 'name' => 'John']
```

### to\_array()

[](#to_array)

Convert object to array:

```
$array = Obj::to_array( $user );        // Public properties only
$array = Obj::to_array( $user, true );  // Include private/protected
```

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

[](#requirements)

- PHP 7.4+
- WordPress 5.0+ (optional, works with any PHP project)

License
-------

[](#license)

GPL-2.0-or-later

Support
-------

[](#support)

- [Documentation](https://github.com/arraypress/wp-object-utils)
- [Issue Tracker](https://github.com/arraypress/wp-object-utils/issues)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance44

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/arraypress-wp-object-utils/health.svg)

```
[![Health](https://phpackages.com/badges/arraypress-wp-object-utils/health.svg)](https://phpackages.com/packages/arraypress-wp-object-utils)
```

###  Alternatives

[winzou/state-machine-bundle

Bundle for the very lightweight yet powerful PHP state machine

33910.7M19](/packages/winzou-state-machine-bundle)[ml/iri

IRI handling for PHP

267.1M6](/packages/ml-iri)[genphrase/genphrase

Secure passphrase generator for PHP applications

115318.2k4](/packages/genphrase-genphrase)[strictus/strictus

Strict Typing for local variables in PHP

1627.4k](/packages/strictus-strictus)[ollyxar/websockets-chat

Laravel WebSockets Chat

431.1k](/packages/ollyxar-websockets-chat)

PHPackages © 2026

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