phpgt/propfunc
A small PHP library that uses magic __get/__set methods to expose getters and setters as normal properties via the MagicProp trait, enabling live and read-only computed properties for DOM-style implementations. Note: PHP 8.4 property hooks may soon make it obsolete.
PropFunc now uses GT\PropFunc and a clearer naming convention for magic property accessors. When upgrading to this major release, rename hooks such as __prop_get_name and __prop_set_name to __propGetName and __propSetName. PHP 8.1 or later is required; the legacy Gt\PropFunc namespace remains autoloadable.
Sometimes it becomes useful to store the value of a class's magic properties internally, so this minor patch release introduced the __prop internal property, which can be access by any class using the MagicProp trait.
PropFunc is heavily used in php.gt/dom due to the reliance on a the W3C specification. There have been minor improvements made since it was integrated within Dom, so now v1 is being released to allow Dom to get ready for its next stable release.
Have fun!
This release finalises the way private/protected values should be accessed via the magic methods. Now if a class needs one of its public properties changing to read-only, it can do by making the property private/protected and implementing the magic getter.
The simple functionality of the repository is now tested. The main plans are for using with PHP.Gt/Dom, so before v1 is released it will be battle-tested in a few real world applications.
How can I help you explore Laravel packages today?