Composer Autoloading for classes without php extension

北城以北 提交于 2020-07-22 21:39:31

问题


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:

  1. Rename all .class.php to .php if it is your own library
  2. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!