PHPackages                             nghh/lib-wordpress - 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. nghh/lib-wordpress

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

nghh/lib-wordpress
==================

WIP – full libraray of wordpress utilities and helper for theme development coming soon

v1.0.1(3y ago)08MITPHPPHP &gt;=8.0

Since Dec 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/nghh/lib-wordpress)[ Packagist](https://packagist.org/packages/nghh/lib-wordpress)[ RSS](/packages/nghh-lib-wordpress/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

Nghh nghh/lib-wordpress
=======================

[](#nghh-nghhlib-wordpress)

Library of PHP Utilities and Helper Classes for Wordpress

---

Table of Contents
-----------------

[](#table-of-contents)

- [WP Router](#wp-router)
- [Config](#config)

---

WP Router
---------

[](#wp-router)

A MVC Router the Wordpress way. This router works like the default wp template hierarchy.
@see

Currently you should have the following controllers and methods:

SingularController::post()
SingularController::page()
SingularController::attachment()

ArchiveController::category()
ArchiveController::postTag()
ArchiveController::author()

ErrorController::error404()

IndexController::frontPage()
IndexController::home()

```
// in your theme e.g. functions.php
use Nghh\Lib\Wordpress\Utils\WP_Router;

// Optional args. If you use namespace, pass it like this
$args = [
    'namespace' => __NAMESPACE__ . '\Controllers\\',
    'env'       => 'local'
];

(new WP_Router($args))->registerHooks();

// A controller can look like this e.g. Controllers/SingularController.php
namespace Nghh\Theme\Controllers;

use Nghh\Theme\Models\Post;
use Nghh\Theme\Models\Page;
use Nghh\Theme\Models\Attachment;

class SingularController extends BaseController {

    public function page()
    {
        echo $this->view('pages.singular.page', ['Page' => new Page()]);
    }

    public function post()
    {
        echo $this->view('pages.singular.post', ['Post' => new Post()]);
    }

    public function attachment()
    {
        echo $this->view('pages.singular.attachment', ['Attachment' => new Attachment()]);
    }
}
```

There is a wp filter, where you can modify the controller and action

```
add_filter('nghh/lib/router', 'nghh_modify_controller', 10, 2);

function nghh_modify_controller($controller, $wp_query)
{
    /**
     * $controller['name] = 'singular'
     * $controller['action] = 'post'
     *
     * => calls SingularController::post()
    */

    return $controller;
}
```

---

Config
------

[](#config)

Config class based on laravel config system.

```
// functions.php
use Nghh\Lib\Wordpress\Utils\Config;

/**
 * Init config class in your functions.php
 * and pass full path to config dir and environemt
 */
Config::instance()->init('/path/to/config/dir', 'local');

// config/app.php
return [
    'version' => '0.0.1'
];

// You can then get config data with helper class function like this:
\Nghh\Lib\Wordpress\func\config('app.version');

// => 0.0.1
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Total

4

Last Release

1337d ago

Major Versions

0.0.2 → v1.0.02022-01-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/321916a1582f43ac1e1aeb03ab11859eeb50f004c38c3790194227f519a596d1?d=identicon)[nghh](/maintainers/nghh)

---

Top Contributors

[![nghh](https://avatars.githubusercontent.com/u/1392925?v=4)](https://github.com/nghh "nghh (23 commits)")

---

Tags

helperwordpresslibraryutilities

### Embed Badge

![Health badge](/badges/nghh-lib-wordpress/health.svg)

```
[![Health](https://phpackages.com/badges/nghh-lib-wordpress/health.svg)](https://phpackages.com/packages/nghh-lib-wordpress)
```

###  Alternatives

[samrap/acf-fluent

A fluent interface for the Advanced Custom Fields WordPress plugin

28656.0k4](/packages/samrap-acf-fluent)

PHPackages © 2026

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