Closed benjaminpick closed 9 years ago
I don't think we would want to support dynamically modifying the object like that. I'd suggest just using subclasses to achieve what you want (or just using the array from the lower-level MaxMind DB reader directly).
Thanks for your reply. I don't see a way to subclass Trait without re-implementing the high-level readers. However I realized that as you don't implement the __set()-Method, I can just continue to use the $record->newAttribute = $value
-Method.
Hi,
I am the developer of a wordpress plugin that provides easy access to your API (https://wordpress.org/plugins/geoip-detect/) and would like to add new properties to the returned object. The only way I could do it is a) a proxy object or b) modifying the protected variable
$raw
or$validAttributes
. Is there a nicer way to do this?For example, I would propose a new top-level property that contains either a raw stdclass (approx. what the legacy API did) or a class that has a static function "addValidAttribute" allowing 3rd-party-library to register their property names. The Name of the proposed property could be used to communicate that this is non-standard Maxmind API.
Happy to send a pull request if you like me to.