27

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?

3
  • composer create-project symfony/framework-standard-edition ./ "2.4.6"
    – Cerad
    Sep 9, 2014 at 17:45
  • 3
    What's wrong with installing the latest possible bugfix release of a framework? I expect the Symfony project to honor the semantic versioning and only add bugfixes in 2.4, and only add compatible features in 2.5 and above. I would assume you are safe to only require some 2.4.* version. You will be able to easily benefit from bugfixes by simply updating your dependencies.
    – Sven
    Sep 10, 2014 at 20:35
  • I have some dependencies with VERY specific version requirements.
    – astletron
    Sep 11, 2014 at 12:23

4 Answers 4

55

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

with symfony :

alternatively try the Symfony Installer for the symfony command.

To create a traditional web application :

symfony new --webapp 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
2
  • 2
    got some issues, Symfony installer seems doesn't reliable. I get following errors: "Could not find package symfony/skeleton with version 4.4.0. " and " Could not parse version constraint lts: Invalid version string "lts" " Nov 24, 2019 at 10:27
  • I need to install symfony webapp using the composer.phar in the folder, not the global version, and I'm not seeing how to do that.
    – SteveExdia
    Aug 15, 2022 at 23:48
6

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.

2
  • 1
    The second command not working either with composer 2.0.11
    – DrLightman
    Mar 2, 2021 at 12:09
  • @DrLightman: Your command line interpreter may need quoting on the caret "^" character to understand you entering the command. Perhaps you entered that character verbatim (as-is)?
    – hakre
    Jan 28 at 8:50
0

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
2
  • 1
    Thanks for this idea. I think even better might be to clone 2.4.6 from github and then run composer install (basically what composer create-project does but with the desired version of Symfony).
    – astletron
    Sep 11, 2014 at 12:25
  • Yep. I am just used to using composer and was a bit surprised that it did not give exactly what was requested. But git clone certainly works.
    – Cerad
    Sep 11, 2014 at 12:49
-1

If you are using Symfony CLI try using

symfony new my_project_name --version=5.3
1
  • How is this different from the existing and accepted answer? What is the benefit of it in Jan 22 to have this as an additional answer on the same page? Why should this be tried? Doesn't it answer the question clearly? Please add all the relevant context.
    – hakre
    Jan 28 at 8:47

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.