Where is the composer JSON

Package management with Composer: Documentation facilitates overview

During installation or updates, Composer creates another JSON file (“composer.lock”) in which the packages are documented, including the version number and dependencies. From now on, the content of this file determines what is downloaded with further install commands. This ensures that all employees in a project receive exactly the same package versions - regardless of the content of the composer.json. For this to work, composer.json and composer.lock must be versioned accordingly in Git or SVN, in contrast to the downloaded packages themselves, which are exempt from versioning.

Installed packages are by default in a so-called "vendor" directory and can be used directly in the project. Composer comes with an autoload mechanism so that you can save yourself the hassle of including files and directories - more on that later.

Install Composer: very easy

The installation of Composer is very easy: EXE installers are available for Windows for download, under Linux, Mac OS and Unix a phar file does the work. It is also a good idea to move the phar file to the PATH instead of keeping it locally in the project
save. In this way, Composer is available system-wide. Incidentally, the installation is even easier with a package manager, for example with Homebrew under Mac OS.

Installation under Linux, Mac OS and Unix $ curl -sS https://getcomposer.org/installer | php

Listing 1

Installation using the package manager $ brew install composer

Listing 2

In order to be able to manage dependencies in the project with Composer, composer.json must be created as a starting point [2]. A wizard is available on the command line for this with “composer init”. After a short question-and-answer game, the file is filled with basic meta data. The init command also adds the vendor directory to the .gitignore.

You might be interested in that too