Search code examples
phpfilecomposer-phpautoloadpsr-4

Composer classmap and loading files with non-standard extensions


When loading files through the composer classmap functionality is it possible to load PHP files that have non-standard extensions such as myFileName.stub or myFileName.foo ?

At present it seems not to be loading them.


Solution

  • Composer will currently include files with the following extensions:

    .php .inc .hh

    The last one is for HHVM stuff.

    Relevant lines from the class map generator here:

    https://github.com/composer/composer/blob/master/src/Composer/Autoload/ClassMapGenerator.php#L62 https://github.com/composer/composer/blob/master/src/Composer/Autoload/ClassMapGenerator.php#L76

    So, looks like you'll need a custom map generator...