首页 > 为什么PHPWord的源代码中没有vendor的文件夹?

为什么PHPWord的源代码中没有vendor的文件夹?

在PHPWord/bootstrap.php
中:

$vendorDirPath = realpath(__DIR__ . '/vendor');
if (file_exists($vendorDirPath . '/autoload.php')) {
    require $vendorDirPath . '/autoload.php';
} else {
    throw new Exception(
        sprintf(
            'Could not find file \'%s\'. It is generated by Composer. Use \'install --prefer-source\' or \'update --prefer-source\' Composer commands to move forward.',
            $vendorDirPath . '/autoload.php'
        )
    );
}

但在这里:https://github.com/PHPOffice/...
并没有看到vendor的文件夹?
这是怎么回事?


你开发一个项目通过composer进行包依赖管理, 然后把它开源把到github上, 但是你依赖的第三方库是没必要放到版本控制器中的.
只需要把composer.json文件放上去, read.me文件中一般会说明安装方式, 让你运行 composer install,
所以一般会把vendor忽略掉, git忽略掉vendor的方法是在 .gitignore 增加这个目录.


throw的Exception里面已经写的很明白了


composer install一下应该就会生成。
没用使用composer包管理就没有vendor。

【热门文章】
【热门文章】