简体   繁体   中英

How to install symfony with composer?

I am using Windows 10 When I install symfony2 with:

composer create-project symfony/framework-standard-edition my_project_name

Error:

bash: composer: command not found

To downloads symfony, you need to download symfony.phar (a small file PHP) from this link .

  • Then, you have to move in your usual Web directory C:\\wamp\\www on windows and /var/www on Linux ;
  • Execute php symfony.phar new project_name_and_version for example : symfony.phar new symfony2.8 to download Symfony 2.8 .

    Then, you can :

  • Change your current directory to /var/www/html/project_name on Linux or C:\\wamp\\www on windows ;

  • Configure your application in app/config/parameters.yml file ;

  • And (always) read the documentation at http://symfony.com/doc .

Good luck ^^ !

Update:

In Symfony 4 the symfony installer is abandoned. So, to create a new Symfony application you need:

  • to have PHP 7.1 (or higher)
  • to run php composer.phar create-project symfony/skeleton my-project "3.4.*" in your terminal.

You need to install composer before. From your command line:

php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === '7228c001f88bee97506740ef0888240bd8a760b046ee16db8f4095c0d8d525f2367663f22a46b48d072c816e7fe19959') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Instructions got from here:

https://getcomposer.org/download/

The recommanded way to install Symfony is through a command, named symfony .

Read the docs from the official symfony website: http://symfony.com/doc/current/book/installation.html , for more info.

So,

Then you can install composer , as the official docs says, and use it for installing packages inside your Symfony project.

Happy coding!

I tried this one:

php symfony.phar new symfony2.8

The results is this

[RuntimeException]
The Symfony Installer is not compatible with Symfony 4.x or newer versions.
Run this other command to install Symfony using Composer instead:
composer create-project symfony/skeleton symfony2.8

I tried the suggested command and it start download and install automatically

composer create-project symfony/skeleton symfony2.8

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM