opis / closure

Serialize closures (anonymous functions)
https://opis.io/closure
MIT License
2.5k stars 84 forks source link

Recursively wrap closures within existing object #131

Open oojacoboo opened 1 year ago

oojacoboo commented 1 year ago

Excellent lib - thanks for this!

I'm not sure if this has been discussed before, but I'm wondering if there is a way to wrap closures nested within an existing object. We're trying to do some caching for a rather large object that includes vendor managed objects and don't have the ability to wrap closures within it directly.

Are there any current plans or docs around this?

Maybe something like this would work with a check on instanceof \Closure... https://gist.github.com/mlconnor/2989980

frodeborli commented 2 months ago

@oojacoboo I published https://github.com/frodeborli/serializor today, which should handle the scenario you mention.