简体   繁体   中英

Where should the composer.json and composer.lock files should be?

I've never used Composer before, but installed it so I could set twig up the recommended way.

I now have composer.json and composer.lock files in two separate directories. How do I determine where they SHOULD be? I assume they certainly shouldn't be in my public html root, as one of them has managed to be?

The composer.json file should be created at the topmost directory of your project, ie the top directory that is in version control. Subdirectories of this directory likely are for example the "public" or "htdocs" or "www" directory which is the document root for the web server.

By using Composer, this directory will also get a "vendor" directory where the packages are being placed, as well as the composer.lock file which records the exact versions being installed.

Do commit both composer.json and composer.lock . Don't commit the vendor folder, put it onto the ignore list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM