How do I stop PHP-Composer library to load automatically?

I only use PHPUnit for testing and development, I don't want my application to automatically load them on the production server, is that possible?

"require-dev": {
    "phpunit/phpunit": "4.2.*",
..

      

I see the file "autoload_classmap.php" contains lines like ..

return array(
    'File_Iterator' => $vendorDir . '/phpunit/php-file-iterator/File/Iterator.php',
    'File_Iterator_Facade' => $vendorDir . '/phpunit/php-file-iterator/File/Iterator/Facade.php',

      

Updated:

I want pure env production and don't want to autoload phpunit, I only need phpunit during development. So, can composer create two autoload.php files so I can include them depending on my current env?

+3


source to share


1 answer


--no-dev

: Skip installation of packages listed in require-dev

composer install --no-dev --optimize-autoloader

      



You might also want to do the following: --optimize-autoloader

(-o): convert PSR-0/4 to auto-load to classmap to get a faster auto-loader. This is recommended specifically for production, but may take a little time to start up, so it is not currently running by default.

+5


source







All Articles