In big projects where there are installed more than one framework, we could detect the needed library at runtime based on stack back trace. The result could be cached statically or per factory class instance that will be cached in framework's DI container.
Detection could be configured or overridden by construct parameters.
What problem would this fix or what would be the use case? I did not do any testing but I guess parsing stack trace would be slower than a call to class_exists().
In big projects where there are installed more than one framework, we could detect the needed library at runtime based on stack back trace. The result could be cached statically or per factory class instance that will be cached in framework's DI container. Detection could be configured or overridden by construct parameters.