Releases: rtCamp/wp-framework
Releases · rtCamp/wp-framework
Release list
v1.0.1
Fixed
Singletonreturns to the ecosystem-standard storage shape:
protected static $instance, stored byget_instance()once the constructor
returns. The class-string-keyed private map introduced for 1.0.0 broke a real
consumer contract — a heavy constructor assigningstatic::$instance = $this;
first so work done during construction can re-enterget_instance(), which
fataled theme-elementary on 1.0.0 with "Access to undeclared static property".
That early-assignment guard is now the documented, tested pattern. Trade-off,
also documented on the trait: a class using the trait and its subclasses share
one storage slot, so do not callget_instance()on a subclass of a singleton.
Full changelog: v1.0.0...v1.0.1
v1.0.0
Initial release. Requires PHP 8.2+.
Added
- Loaders
AssetLoader— registers scripts, styles and script modules from a build
directory, reading dependencies and versions from the generated
*.asset.phpmanifests, with ahandle()helper for namespaced handles.TemplateLoader— locates and renders templates across the child theme,
parent theme and the package's own directory, honouring WordPress'
locate_template()precedence, with a per-request location cache.ComponentLoader— resolves and renders self-contained component packages
across the same hierarchy and registers their assets on demand. Render and
asset hooks are namespaced per loader context, so one package's listeners
never fire for another's.
- Composition
Containerand theLoadertrait — instantiate a list of classes, register
hooks for anythingRegistrable, and cache anythingShareable.- Contracts:
Registrable,ConditionallyRegistrable,Shareable,
CLICommand. Singletontrait, storing one instance per concrete class so a parent and
subclass never share one.
- Abstract base classes —
AbstractModule,AbstractFeature,
AbstractBlock,AbstractPostType,AbstractTaxonomy,AbstractUserRole,
AbstractShortcode,AbstractAdminPage,AbstractSettingsPageand
AbstractRESTController. - Utilities
Cache— object-cache wrapper with group namespacing and opt-in
stale-while-revalidate.Encryptor— authenticated encryption (AES-256-GCM by default), injectable
per key domain, with akey()seam for sourcing secrets from a KMS or
environment. Secrets of any length are derived to a full cipher-length key.FeatureSelectorandFeatureSelectorSettingsPage— feature flags stored in
a single option, overridable by PHP constants for hard locks.Transients— prefix-namespaced transient access.Timer— named, multi-scope timing.Logger— levelled logging.
- Reference documentation under
docs/, a GPL-2.0-or-laterLICENSE.md, and a
WordPress integration test suite running against@wordpress/env.
Install
composer require rtcamp/wp-framework:^1.0This package is not on Packagist. Add the repository to your composer.json:
{
"repositories": [
{ "type": "vcs", "url": "https://github.com/rtCamp/wp-framework.git" }
]
}Full changelog: CHANGELOG.md