IMPORTANT EDIT (2020-04-28):
You are trying to install this project:
https://www.drupal.org/project/composer
But that is not Composer -- it's a Drush extension for managing Composer.
From the project documentation:
Composer is a PHP package management tool to help manage your project or libraries' dependencies. This project allows use of Composer from Drush.
Installing this module on the server will not allow you to manage your Drupal 8 project using Composer. You need to set up your Drupal 8 project correctly using Composer in the first place, and worry about getting it onto the server later (whether you use the modern DevOps way using git hooks to deploy, the old-school sysadmin way using rsync
to deploy, or the stone-age way using SFTP with Filezilla or a similar GUI file transfer utility.)
ORIGINAL ANSWER (2020-04-26):
Welcome to Drupal Answers!
Since you just started from scratch, you won't lose much work if you start from scratch again.
First, install Composer on your local computer: https://getcomposer.org/
Don't try to install Composer on the server. Depending on your hosting, it may be possible to do that, but it is seldom the best way to do things. Composer is a well-known memory hog, and many web hosts will not allow you to run composer install
on the server. Even if it is allowed, it's a terrible misuse of RAM and CPU cycles on a production server. Don't do it.
Next, install a new Drupal 8.8 site on your local computer (here called "my-project") using the drupal/recommended-project
template:
composer create-project drupal/recommended-project my-project
At this point, I recommend using git init
to put your project in version control.
Then use Composer to manage project dependencies such as installing contrib modules:
composer require drupal/phone_international
You can create a .gitignore
file to tell git to ignore the core, contrib and vendor directories, which will be recreated afresh whenever you run composer install
(from instructions in the composer.json
and composer.lock
config files). This keeps your git repo and pull requests small by excluding hundreds of thousands of lines of open-source code that are common to all plain-vanilla Drupal 8 (or 9) projects.
Finally, you'll want to set up some method of deploying the code from your local computer to the server. For tips on that, see my other answer:
https://drupal.stackexchange.com/a/292006/80164
Note that you will probably want to see the local Drupal site in a browser before deploying the code to the server. There are many ways to accomplish this.
Personally I like to use Lando to manage my Drupal projects in Docker containers, but other options include Docksal, DDEV, Vagrant/Virtualbox, LAMP (Linux), MAMP (Mac), WAMP (Windows), XAMPP (Linux, Solaris, Windows, and Mac), and others.
There's a lot to learn, and many of your questions will be outside the scope of this forum (which primarily focuses on issues specific to Drupal core and developing custom module and theme code with Drupal APIs). You might get better support for general questions on Drupal Slack.
Assuming that you want to try Lando, you can install it with all its dependencies using the Hyperdrive installer script for Mac or Linux. Then navigate to the my-project
directory you created with composer create-project
and execute something like this:
lando init --source cwd --recipe drupal8 --webroot web --name my-project
That would set up Docker containers for your appserver and database with a default configuration suitable for a Drupal 8 project. Then you'd just type:
lando start
Then you can view your local site in the browser at http://my-project.lndo.site to finish installing it and configuring it. After this, you can use Lando to manage your project inside the Docker container. Type lando
on a line by itself to see what tools are available (including Composer, Drush, Drupal Console, MySQL CLI, log viewer, and tools to import/export database backups.)
Make sure that every time you change the code, you commit it to git and test it locally before deploying it to the server. (Later, you might end up setting up different servers for Dev, Test and Live environments.)
Good luck, and happy Drupaling!