Just saw this thread. I was going to suggest having an adapter class or something (type-hinting against a specific implementation would certainly be undesirable), but the callback sounds like a great idea. You can simply document it's "interface" here and let the calling code prepare it with the appropriate serializer implementation.