Installing and configuring Composer on my localhost

Asked

Viewed 574 times

0

To use the local Composer I should install it in the folder where my projects are located? In case C:/Users/Me/Jobs...

And as there are several projects (sites), for each one I must have the Composer.json right? But what about the issue of libraries, for example phpmailer, in each project I must install it or just add it to Composer.json require you? This part is too confusing for me.

One more question, and when putting this project online will work the issue of libraries or I will have to run Composer in the online environment?

2 answers

0

The Next Tutorial (Click here to access) Answers your installation questions. Each project will have its own Composer.json with all the libraries you use for the project. (Following the example of phpmailer let’s say that you have 3 projects that use this library, then you will need to do phpmailer require in all 3 projects as you prefer to use Composer may be composer require phpmailer/phpmailer or by adding the following line to your Composer.json "phpmailer/phpmailer": "~6.0". And yes, if you want to keep your project dependencies up to date and especially if you are using Composer autoload you will need to have it installed on your web server.

  • In case, I have to install Composer on my local htdocs and on my web server install on the www root?

  • I made another answer because it got too long.

0


If you are using windows and have done the installation by the installer it is very likely that Composer is Global and therefore you can use in any directory of your machine, simply having the file Composer.json if it is linux is more likely that you have done the installation by terminal and it is easier to choose between a local or global installation in which case if you are using local installation you need to install in the root directories of each project and on the server will also have to install in the project root directory. See in this article how to do local and global installation on linux and windows.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.