I have an old library I need in my project that doesn't utilize PSR-0/4 or any namespacing at all. It has loads of PHP files with different classes. Let's say I add this library to my project via 'classmap' autoloading (as Composer documentation suggests):
"autoload": {
"classmap": [
"libraries/some-lib"
]
}
The problem is this library doesn't use inheritance/polymorphism - it has base classes with the same names and same methods (but different implementations of those methods) in different PHP files.
libraries/some-lib/Foo.php:
class Foo
{
public function bar()
{
...
}
}
libraries/some-lib/Foo-alternate.php:
class Foo
{
public function bar()
{
...
}
}
So when composer is generating it's classmap Ambiguous class resolution warnings are generated for them and only one version of Foo will be available to me in my project's code via \Foo because of name collisions.
My question is what is the way to go about this problem here without modifying library code? Is there any options Composer provides for situations like this so that I can import both versions of Foo class into composer's classmap and distinguish between the two in my project as a result?
namespaceof their own? - nice_dev