Skip to content
PHP Logo

Are there established standards for folder structure when using external libraries in PHP projects?

When using external libraries in PHP projects, it is important to maintain a consistent folder structure to ensure organization and ease of maintenance. While there are no strict standards set in stone, a common practice is to create a "vendor" directory at the root of your project where all external libraries are stored. Within the vendor directory, each library should have its own subdirectory to keep things organized.

php
/project
    /vendor
        /library1
            /src
            /tests
        /library2
            /src
            /tests
    /src
    /tests
    index.php