Open the demo website’s shell using WP Local and navigate to the plugin’s directory.
You can use the following shortcut command in the CLI.
To install composer, enter this command.
After running this command, the lib directory and composer.json will be generated. We now have changes to our file structure. Let us discuss the changes to the structure.
This file locks the dependencies of your project to a known state. That is, it gets the version numbers of the dependencies in use. Suppose someone wishes to install these dependencies again in future. The composer will download dependencies based on the versions specified in this file. The later version of the dependencies will not be downloaded/used.
We have the composer directory in this folder with our autoloaded class map. We also have the autoloader (autoload.php).
We can now be confident that every file in the core folder is autoloaded for us and is ready for initialisation.
This kind of setup/structure has some benefits.