问题
I'm creating a composer package but my library uses a ".class.php" extension instead of the usual ".php" extension.
E.g. BaseController.class.php
for BaseController
class
As a result of this the Composer Autoloader is unable to find my files.
How do I fix this?
回答1:
After a lot of research there are two ways of doing it. Unfortunately neither is good enough but for now anyone who faces this problem can use it:
- Rename all .class.php to .php if it is your own library
- In line 303 of ClassLoader.php (inside composer folder) change
.php
to.class.php
$file = $this->findFileWithExtension($class, '.php'); //line 303
$file = $this->findFileWithExtension($class, '.class.php'); //line 303
Hopefully there will be support for this in future versions!
来源:https://stackoverflow.com/questions/27600213/composer-autoloading-for-classes-without-php-extension