Home >Backend Development >PHP Tutorial >Why is there no vendor folder in the source code of PHPWord?

Why is there no vendor folder in the source code of PHPWord?

WBOY
WBOYOriginal
2016-08-18 09:15:572221browse

In PHPWord/bootstrap.php
:

<code>$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'
        )
    );
}
</code>

But here: https://github.com/PHPOffice/...
Don’t see the vendor folder?
What’s going on?

Reply content:

In PHPWord/bootstrap.php
:

<code>$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'
        )
    );
}
</code>

But here: https://github.com/PHPOffice/...
Don’t see the vendor folder?
What’s going on?

composer install should generate it.
If you don’t use composer package management, there will be no vendor.

Throw’s Exception has been written very clearly

You develop a project through composer for package dependency management, and then open source it and put it on github, but there is no need to put the third-party libraries you rely on in the version controller.
You only need to put the composer.json file Go up, the read.me file will usually explain the installation method, and let you run composer install,
so vendor will usually be ignored. The way to ignore vendor in git is to add this in .gitignore Directory.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn