How do I create a project based on a specific version of Symfony using composer?

跟風遠走 提交于 2020-06-09 17:46:28

问题


I want to create a project based on Symfony 2.4.6.

These commands:

../composer.phar create-project symfony/framework-standard-edition=v2.4.6 ./
../composer.phar create-project symfony/framework-standard-edition ./ 2.4.6
../composer.phar create-project symfony/framework-standard-edition ./ v2.4.6

all say that they are installing Symfony 2.4.6, but I end up with 2.4.9 in my composer.lock and in vendors/. Is there a way to force creation of a project based specifically on 2.4.6?


回答1:


try the Symfony Installer ...

To create a traditional web application :

symfony new --full my_project_name

and to build a lightweight app like a microservice, console application or API :

symfony new my_project_name

to install the current LTS version :

symfony new my_project_name --version=lts

to install the latest stable version :

symfony new my_project_name --version=stable

to install the development version :

symfony new my_project_name --version=next

to install a specific version :

symfony new my_project_name --version=4.4

OR with composer :

composer create-project symfony/website-skeleton my_project ^4.4.0

to install a full project in the 4.4.X stable version

or :

composer create-project symfony/skeleton my_project ^4.4.0 

to install a lightweight project with fewer requirements




回答2:


I tried:

composer create-project symfony/website-skeleton my_project 4.4.0 

but this didn't work. I got following error:

Could not find package symfony/skeleton with version 4.4.0.

Then I tried:

composer create-project symfony/website-skeleton my_project ^4.4.0

and this worked.




回答3:


Interesting. There might be something wrong with the standard edition package. I got 2.4.* as well. But no problem. Just edit the composer.json file and run composer install.

mkdir s26
cd s26
composer create-project symfony/framework-standard-edition path/ "2.4.6"
rm composer.lock
rm -r vendor
edit composer.json and change 2.4.* to 2.4.6
composer install
app/console 
  Symfony version 2.4.6 - app/dev/debug


来源:https://stackoverflow.com/questions/25749655/how-do-i-create-a-project-based-on-a-specific-version-of-symfony-using-composer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!