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

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

wpsocio/wp-utils
================

Utilities for WordPress plugins and themes

v1.0.11(4mo ago)112GPL-3.0-or-laterPHP

Since Jan 26Pushed 4mo agoCompare

[ Source](https://github.com/wpsocio/wp-utils)[ Packagist](https://packagist.org/packages/wpsocio/wp-utils)[ RSS](/packages/wpsocio-wp-utils/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (13)Used By (0)

WPSocio WPUtils
===============

[](#wpsocio-wputils)

Utilities for WordPress plugins and themes.

Usage
-----

[](#usage)

```
composer require wpsocio/wp-utils
```

```
require_once __DIR__ . '/autoload.php';
```

### `WPSocio\WPUtils\Options`

[](#wpsociowputilsoptions)

Allows an easy access to plugin or theme options/settings which are in the form of an array, no matter how deep it is.

```
$option_key    = 'option_name_here';
$store_as_json = false

$options = new \WPSocio\WPUtils\Options( $option_key, $store_as_json );

$options->get( 'some_key' ); // false
$options->get( 'some_key', 'default_value' ); // 'default_value'

$options->set( 'some_key', 'some_value' );
$options->get( 'some_key' ); // 'some_value'

// Updates the value in the database if $option_key is provided
$options->set_data( [
    'first' => 'some_value',
    'second' => [
        'a1' => 'a1-value',
        'a2' => 'a2-value',
    ],
] );

$options->get_path( 'second.a2' ); // 'a2-value'
```

### `WPSocio\WPUtils\Requirements`

[](#wpsociowputilsrequirements)

Checks if the environment meets the requirements.

```
$plugin_file = '/path/to/plugin/file.php';

$requirements = new \WPSocio\WPUtils\Requirements( $plugin_file );

if ( $requirements->satisfied() ) {
    // Do something
}

$details = $requirements->get_env_details();

/*
[
    'data' => [
        'PHP' => [
            'version' => '8.0.0',
            'min'     => '7.0',
        ],
        'WP'  => [
            'version' => '5.3',
            'min'     => '5.3',
        ],
    ],
    'satisfied' => true,
]
*/
```

### `WPSocio\WPUtils\ViteWPReactAssets`

[](#wpsociowputilsvitewpreactassets)

Manage the assets for a React app built with Vite using [`@wpsocio/vite-wp-react`](https://www.npmjs.com/package/@wpsocio/vite-wp-react) npm package.

```
$assets_dir = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/assets/build';
$assets_url = untrailingslashit( plugins_url( '', __FILE__ ) ) . '/assets/build';

$assets = new \WPSocio\WPUtils\ViteWPReactAssets( $assets_dir, $assets_url );

$entry = 'js/settings/index.tsx';

$assets->enqueue(
    $entry,
    [
        'handle'              => 'some-js-handle',
        'script-dependencies' => [ 'wp-element', 'wp-i18n' ],
        'style-dependencies'  => ['wp-components'],
    ]
);

// OR

[ $script_handle, $style_handles ] = $assets->register(
    $entry,
    [
        'handle'              => 'some-js-handle',
        'script-dependencies' => [ 'wp-element', 'wp-i18n' ],
        'style-dependencies'  => ['wp-components'],
    ]
);

// Later on
$assets->enqueue( $entry );
// or
wp_enqueue_script( $script_handle );
foreach ( $style_handles as $style_handle ) {
    wp_enqueue_style( $style_handle );
}
```

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

[](#requirements)

- `PHP >= 8.0`
- `WP >= 6.4`

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance75

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

Recently: every ~74 days

Total

12

Last Release

137d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/112321edeeaa9cf3cced45d0303c814b3cff9d1a9cf1fe085ad4004cec938e28?d=identicon)[irshadahmad21](/maintainers/irshadahmad21)

---

Top Contributors

[![irshadahmad21](https://avatars.githubusercontent.com/u/94346512?v=4)](https://github.com/irshadahmad21 "irshadahmad21 (12 commits)")

---

Tags

utility-classesutility-librarywordpresswordpress-development

###  Code Quality

TestsPest

### Embed Badge

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

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

###  Alternatives

[symfony/polyfill-apcu

Symfony polyfill backporting apcu\_\* functions to lower PHP versions

63280.0M153](/packages/symfony-polyfill-apcu)[focuslabllc/craft-cheat-sheet

A fast and customized set of instantly usable Field code samples.

21021.3k](/packages/focuslabllc-craft-cheat-sheet)[arcanedev/gravatar

A library providing easy gravatar integration/generation (Laravel supported).

1986.8k](/packages/arcanedev-gravatar)

PHPackages © 2026

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