Skip to content

Releases: josbeir/cakephp-attribute-registry

0.5.0

08 Jan 11:21

Choose a tag to compare

🎉 Major Improvements

Simplified Object Serialization with brick/varexporter

  • Replaced native var_export() with brick/varexporter
  • Breaking Change: Objects no longer require __set_state() method
  • Object arguments now serialize automatically via reflection

Typed Event Classes

  • Introduced dedicated event classes with full type safety
  • Better IDE autocomplete and static analysis support
  • New event classes:
    • BeforeDiscoverEvent, AfterDiscoverEvent
    • BeforeScanEvent, AfterScanEvent
    • BeforeCacheClearEvent, AfterCacheClearEvent
  • Each event has a NAME constant and typed accessor methods

📦 Dependencies

  • Added: brick/varexporter: ^0.7.0

📝 Migration Guide

For existing users: No action required. The changes are backward compatible. If you have objects with __set_state() methods in attribute arguments, they will continue to work but the method is no longer necessary.

0.4.1

06 Jan 16:04
392e04f

Choose a tag to compare

🚀 Performance Improvements

Path Resolution Optimization (3.2-3.4x faster)

Completely refactored the path resolution system to significantly improve scanning performance:

  • Unified Iterator Approach: Replaced mixed glob()/RecursiveDirectoryIterator approach with single RecursiveCallbackFilterIterator pattern
  • Filter During Traversal: Exclusion logic now filters paths during directory traversal instead of after, avoiding unnecessary filesystem operations
  • Performance Gain: 3.2-3.4x faster path resolution (68.8-70.9% time saved) on typical projects with excluded directories like vendor and tmp
  • Early Directory Skipping: Excluded directories are now completely skipped during traversal, not just filtered afterward

0.4.0

06 Jan 14:47
44066c4

Choose a tag to compare

New Features

Event System (#7)

  • Added event dispatching throughout attribute discovery and caching lifecycle
  • 6 new events:
    • beforeDiscover / afterDiscover - Around complete discovery process
    • beforeScan / afterScan - Around file scanning (when not cached)
    • beforeCacheClear / afterCacheClear - Around cache clearing operations

Breaking Changes

File Modification Time Instead of Content Hashing

  • AttributeInfo::$fileHash (string) → AttributeInfo::$fileTime (int)
  • Removed HashUtility class - no longer using xxh3 hashing
  • Cache validation now uses filemtime() instead of hashing file contents

Why This Change?

  • Faster: No hash computation overhead
  • Simpler: Native PHP filemtime() vs custom hashing
  • Sufficient: File modification time detects changes just as reliably

0.3.0

25 Dec 12:08
7e00139

Choose a tag to compare

New Features

  • HashUtility: Centralized hashing utility for consistent xxh3 hashing across plugin (#6)

    • Single source of truth for hash algorithm
    • Cleaner API with HashUtility::hash() and HashUtility::hashFile()
    • Full test coverage (10 tests)
  • Cache Validation: New cache integrity validation system (#5)

    • AttributeCacheValidator service validates cached attribute files
    • AttributeCacheValidationResult value object for validation results
    • --validate option in cache command to verify cache integrity
    • File existence and hash mismatch detection

Improvements

  • Commands Refactored (#5):

    • Renamed to plural forms: attributes:cache, attributes:inspect, attributes:list
    • Former attribute:discover is now attributes:cache
    • Added --no-clear and --clear-only options to cache command
  • PathResolver Simplification:

    • Now accepts PluginLocator directly instead of Closure callback
    • Cleaner API, easier to understand
    • Lazy loading behavior preserved
  • Internal Improvements:

    • Simplified cache key constant (CACHE_KEY vs REGISTRY_CACHE_KEY_ALL)
    • Refactored test helpers to AttributeRegistryTestTrait
    • Updated PathResolver test names for clarity
    • Improved code coverage across all components

0.2.1

24 Dec 16:49

Choose a tag to compare

Changes

  • Support storing plugin names in valueObject in #4
  • Fixed issue with cache clear hook

Full Changelog: 0.2.0...0.2.1

0.2.0

24 Dec 15:04
29234cb

Choose a tag to compare

Release 0.2.0

Major Improvements

Zero-Cost Compiled Cache

  • Replaced runtime cache with pre-compiled PHP files for OPcache optimization
  • Added xxh3 file hash validation for smart cache invalidation
  • Cache files are now pure PHP that gets opcached by the server

Smart Cache Validation

  • Optional file hash validation detects changes automatically
  • Only invalidates modified files (granular invalidation)
  • Configure with 'validateFiles' => Configure::read('debug') for dev-only validation
  • Uses xxh3 algorithm for extremely fast file hashing

Configuration Management

  • Plugin config properly merges with user settings (user values take precedence)
  • Sequential arrays replace, associative arrays merge recursively

Command Improvements

  • Integrated with cache:clear_all command

Bug Fixes

  • Plugin configuration no longer overwrites user settings
  • Fixed plugin path resolution to include all loaded plugins
  • Windows compatibility improvements
  • Proper handling of __set_state() in cached objects

Full Changelog: 0.1.3...0.2.0

0.1.3

23 Dec 15:14

Choose a tag to compare

Features

Atomic Plugin Discovery

  • All enabled plugins (including CLI-only and local plugins) are now scanned regardless of request context (CLI vs web)
  • Introduces PluginPathResolver to retrieve paths for all configured plugins, ensuring consistent attribute discovery across environments

AttributeCollection Query API

  • New fluent collection interface for filtering and querying discovered attributes
  • Methods: attribute(), namespace(), targetType(), className(), attributeContains(), classNameContains()
  • Fully compatible with CakePHP Collection operations (map, filter, groupBy, etc.)

Full Changelog: 0.1.2...0.1.3

0.1.2

22 Dec 21:19

Choose a tag to compare

New features

  • Add support for parameter attributes
  • Add support for constant attributes
  • Improve docs

Full Changelog: 0.1.1...0.1.2

0.1.1

22 Dec 20:50

Choose a tag to compare

  • Add support for excluding attributes from discovery
  • Drop file_size check as this is an orphaned feature that does not belong in current architecture
  • General clean up

0.1.0

22 Dec 17:24
e7485c9

Choose a tag to compare

Initial release