zend-framework2zend-autoloaderzend-loaderzftool2

How to get the ZF classmap_generator.php via Composer without to install the whole Zend Framework?


Due to some issues with the dependencies (zend-test was prohibiting installation of PHPUnit 6), I removed the zendframework/zendframework dependency from the composer.json and installed only the Zend packages I really need. But now, the file classmap_generator.php is missing.

Now I want to get the classmap generator back but without to load the whole framework with all its deoendencies.

Which package do I have to install to get the classmap_generator.php?


Solution

  • You do not need the classmap generator at all, and it is removed from V3 anyway.

    What you should do is remove any Zend Autoload configuration (if you have any in your Module.php files, and replace it with a PSR-0 or PSR-4 config in the autoload section of your composer.json.

    This way, composer handles all the autoloading, and you can use composer install --no-dev --optimize-autoloader --classmap-authoritative for your production deployment, which will generate a very optimised classmap for you!