Let\'s say I release a code library as a standalone PHP class. Someone then uses version 1.0 of that library in their application. Later, I release version 2.0 of the libr
So is there a way to dynamically create a namespace, include a file, and instantiate the class contained within that file in a uniquely-named variable?
Yes, such method exists. You can do anything you want with eval and stream handlers. But it is bad practice and wrong approach - you can try to use factory method (the code is not tested - it only shows example):