Answer the question
In order to leave comments, you need to log in
Using Composer and Git in your project
Good afternoon.
I have a question: I tried to use composer to use some packages in my project, and I had difficulty understanding the process of working in combination with Git for my project. What is the actual difficulty:
I write the following in composer.json:
{
"require": {
"psr/log": "dev-master"
}
}
composer install
Answer the question
In order to leave comments, you need to log in
Don't worry, the versions will be fixed, here's an approximate principle of operation:
When you do a "composer.phar update", the latest changes are pulled from the repositories, and their versions are written to composer.lock.
It is important to put composer.lock in the git of your project.
In the case of a new installation of the project, you need to run “composer.phar install”, then exactly the versions that we have fixed in composer.lock will be installed
When deploying a project, it is often necessary to perform not only copying files from the repository, but also installing software (php, mysql, curl, gearman, etc.) and performing migrations to populate the database and something else. Importing external dependencies is one such operation.
And by fixing the package versions by adding composer.lock to the project repository, you are guaranteed to get exactly the package versions that were used during development.
It is usually assumed that external dependencies are installed via composer. There is no point in keeping them in your repository.
PS But I thought about your question ... You
never know what requirements the project may have, if I find an answer, I'll write it off.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question