Skip to content

Releases: rtCamp/wp-framework

Release list

v1.0.1

Choose a tag to compare

@aryanjasala aryanjasala released this 29 Jul 11:39
87774ee

Fixed

  • Singleton returns to the ecosystem-standard storage shape:
    protected static $instance, stored by get_instance() once the constructor
    returns. The class-string-keyed private map introduced for 1.0.0 broke a real
    consumer contract — a heavy constructor assigning static::$instance = $this;
    first so work done during construction can re-enter get_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 call get_instance() on a subclass of a singleton.

Full changelog: v1.0.0...v1.0.1

v1.0.0

Choose a tag to compare

@aryanjasala aryanjasala released this 27 Jul 19:54
10f9a4d

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.php manifests, with a handle() 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
    • Container and the Loader trait — instantiate a list of classes, register
      hooks for anything Registrable, and cache anything Shareable.
    • Contracts: Registrable, ConditionallyRegistrable, Shareable,
      CLICommand.
    • Singleton trait, storing one instance per concrete class so a parent and
      subclass never share one.
  • Abstract base classesAbstractModule, AbstractFeature,
    AbstractBlock, AbstractPostType, AbstractTaxonomy, AbstractUserRole,
    AbstractShortcode, AbstractAdminPage, AbstractSettingsPage and
    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 a key() seam for sourcing secrets from a KMS or
      environment. Secrets of any length are derived to a full cipher-length key.
    • FeatureSelector and FeatureSelectorSettingsPage — 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-later LICENSE.md, and a
    WordPress integration test suite running against @wordpress/env.

Install

composer require rtcamp/wp-framework:^1.0

This 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