PHPackages                             codelight/wp-decorator - 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. codelight/wp-decorator

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

codelight/wp-decorator
======================

033PHP

Since Mar 6Pushed 5y ago3 watchersCompare

[ Source](https://github.com/codelight-eu/wp-decorator)[ Packagist](https://packagist.org/packages/codelight/wp-decorator)[ RSS](/packages/codelight-wp-decorator/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress Decorator
===================

[](#wordpress-decorator)

A useful library for accessing WordPress's class methods

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

[](#installation)

```
$ composer require codelight/wp-decorator dev-main
```

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

[](#quick-start)

```
use Codelight\WordPressDecorator\WooCommerce\CustomerDecorator;

try {

    $customer          = new WC_Customer(1);
    $customerDecorator = new CustomerDecorator($customer);

    print sprintf('ID: %s', $customerDecorator->getId());
    print sprintf('Email: %s', $customerDecorator->getEmail());

} catch (Exception $e) {
    print $e->getMessage();
}
```

You may interested to extend the class and putting your methods as well.

```
use Codelight\WordPressDecorator\WooCommerce\CustomerDecorator;

class MyCustomerDecoratorClass extends CustomerDecorator
{
    public function __construct(WC_Customer $customer)
    {
        parent::__construct($customer);
    }

    public function getAdminColor()
    {
        return $this->getMeta('admin_color');
    }
}

try {

    $customer          = new WC_Customer(1);
    $customerDecorator = new MyCustomerDecoratorClass($customer);

    print sprintf('Admin color: %s', $customerDecorator->getAdminColor());

} catch (Exception $e) {
    print $e->getMessage();
}
```

Decorators
----------

[](#decorators)

Here are the list of supported classes.

### WordPress

[](#wordpress)

#### Post

[](#post)

```
use Codelight\WordPressDecorator\WordPress\PostDecorator;
$postDecorator = new postDecorator(get_post(1));
```

#### User

[](#user)

```
use Codelight\WordPressDecorator\WordPress\UserDecorator;
$userDecorator = new UserDecorator(get_user_by('id', 1));
```

#### Comment

[](#comment)

soon...

### WooCommerce

[](#woocommerce)

#### Customer

[](#customer)

```
use Codelight\WordPressDecorator\WooCommerce\CustomerDecorator;
$customerDecorator = new CustomerDecorator(new \WC_Customer(1));
```

#### Order

[](#order)

```
use Codelight\WordPressDecorator\WooCommerce\OrderDecorator;
$orderDecorator = new OrderDecorator(wc_get_order(1));
```

#### Product

[](#product)

```
use Codelight\WordPressDecorator\WooCommerce\ProductDecorator;
$productDecorator = new ProductDecorator(wc_get_product(1));
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/thephpleague/container/blob/master/LICENSE.md) for more information.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 85.7% 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/014813826797ac3011077a92f41d74ae92eb8dae62cb8ea7d6def18947918039?d=identicon)[indrek\_k](/maintainers/indrek_k)

---

Top Contributors

[![mostafasoufi](https://avatars.githubusercontent.com/u/701520?v=4)](https://github.com/mostafasoufi "mostafasoufi (6 commits)")[![indrek-k](https://avatars.githubusercontent.com/u/1229164?v=4)](https://github.com/indrek-k "indrek-k (1 commits)")

### Embed Badge

![Health badge](/badges/codelight-wp-decorator/health.svg)

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

###  Alternatives

[eadesigndev/module-fullbreadcrumbs

Full breadcrumbs for product page

223.9k](/packages/eadesigndev-module-fullbreadcrumbs)

PHPackages © 2026

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