[英]How to disable "always include" class in Composer autoload_static.php
Composer in autoload_static.php use class that I don't need them in every app request. autoload_static.php 中的 Composer 使用类,我不需要在每个应用程序请求中使用它们。
'd5fa61a7f6cbc1df09dd4df84549a2dc' => __DIR__ . '/..' . '/rospdf/pdf-php/src/Cpdf.php',
'2d15964294879de66053d54f6bde65d7' => __DIR__ . '/..' . '/rospdf/pdf-php/src/Cezpdf.php',
How to remove them from this autoload file?如何从这个自动加载文件中删除它们? I can delete/comment them manually but every Composer update this file is re-generated.
我可以手动删除/评论它们,但每次 Composer 更新都会重新生成此文件。
I try to add in my main composer.json: "exclude-from-classmap": ["vendor/rospdf/pdf-php/src/"] & run composer dump-autoload bo those class are still in there.我尝试在我的主要 composer.json 中添加: "exclude-from-classmap": ["vendor/rospdf/pdf-php/src/"]并运行composer dump-autoload bo 那些类仍在那里。
You can trick the autoloader of composer and let him think those are already loaded:你可以欺骗作曲家的自动加载器,让他认为那些已经加载了:
<?php
// Setting global variable:
$GLOBALS["__composer_autoload_files"] = [
"d5fa61a7f6cbc1df09dd4df84549a2dc" => true,
"2d15964294879de66053d54f6bde65d7" => true,
];
require "vendor/autoload.php";
But this needs to happen before the vendor/autoload.php
is included.但这需要在包含
vendor/autoload.php
之前发生。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.