WordPress Libs
A WordPress library for supporting a core plugin and theme.
Installation
composer require lipemat/wordpress-libs
- PHP:
>=8.2.0 - Namespace root:
Lipe\Lib\ - Autoload entrypoint:
vendor/autoload.php
Basic usage
<?php
require __DIR__ . '/vendor/autoload.php';
use Lipe\Lib\Api\Api;
use Lipe\Lib\Post_Type\Post_Type;
Api::init_once();
$books = new Post_Type('book');
$books->labels('Book', 'Books');
Getting started
- Install the package with Composer.
- Pick the module that matches the WordPress API you are wrapping.
- Instantiate the fluent builder or call the provided singleton/container helpers.
- Register your objects on the appropriate WordPress hooks.
- Reuse the shared traits (
Singleton,Memoize, object traits, and args traits) across your own library code.
Module overview
| Module | Summary |
|---|---|
| API | Rewrite-endpoint API helpers, route handling, remote requests, and ZIP delivery. |
| Args | Shared fluent argument and nested clause infrastructure used across the library. |
| Blocks | Block registration helpers plus attribute and support builders. |
| CMB2 | Fluent CMB2 box, field, group, and variation wrappers. |
| Comment | Comment object traits plus comment query and update builders. |
| Container | Lightweight container, factory, and hook initialization helpers. |
| Cron | Interfaces and runners for recurring and one-time cron jobs. |
| Db | Typed contracts and helpers for custom database tables. |
| Libs | Internal script/style handles for wordpress-libs assets. |
| Menu | Navigation menu args and menu-item wrappers. |
| Meta | Meta registration, translation, validation, and classic meta boxes. |
| Network | Multisite network object trait with centralized meta access. |
| Post Type | Custom post type registration, labels, capabilities, and admin columns. |
| Query | WP_Query, get_posts, and nested date/meta/tax query builders. |
| REST API | Route, schema, and initial-data helpers for REST integrations. |
| Settings | Settings registration and settings-page composition utilities. |
| Site | Multisite site object trait helpers. |
| Taxonomy | Taxonomy registration, labels, capabilities, and custom taxonomy meta boxes. |
| Theme | Theme resources, script manifests, CSS modules, templates, and sidebars. |
| Traits | Reusable singleton, memoization, and versioned migration traits. |
| User | User object traits plus user query, update, and login form builders. |
| Util | General utility helpers for arrays, cache, cryptography, logging, URLs, and versions. |
For detailed module docs, start at Modules.