Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I need to put file composer.json for composer to work with Symfony

I have installed composer from this link, but I still could not find where do I need to place the composer.json file.

like image 825
Mirage Avatar asked Jul 18 '12 06:07

Mirage


People also ask

Where do I put composer json?

composer. json is a JSON file placed in the root folder of PHP project. Its purpose is to specify a common project properties, meta data and dependencies, and it is a part of vast array of existing projects.

How do I run composer with composer json?

To configure Composer for your PHP app json file specifies required packages. Verify that a composer. json file is present in the root of your git repository. Run composer install (on your local machine) to install the required packages and generate a composer.

Where do you put the composer?

Meanwhile, the global installation allows you to run Composer from anywhere on your system by storing it in the /usr/local/bin directory. However, the global installation method won't work on shared and cloud hosting. Important! If you installed Composer locally, you need to use php composer.

What is require in composer json?

The first thing you specify in composer.json is the require key. You are telling Composer which packages your project depends on. { "require": { "monolog/monolog": "2.0.*" } } As you can see, require takes an object that maps package names (e.g. monolog/monolog ) to version constraints (e.g. 1.0.* ).


3 Answers

In the root of your project. Because you mentioned symfony, just have a look at the composer.json from the symfony-standard edition

https://github.com/symfony/symfony-standard/

Or even better: Follow the official instructions and use symfony-standard as starting point for your project directly.

Start by visiting the Symfony2 download page at http://symfony.com/download. On this page, you'll see the Symfony Standard Edition, which is the main Symfony2 distribution.

You can forkt it directly from github.

like image 187
KingCrunch Avatar answered Sep 17 '22 08:09

KingCrunch


I just found on other topic that you can use :

php composer.phar --working-dir=/home/user/folder/ update
like image 43
Charly Avatar answered Sep 21 '22 08:09

Charly


You may need to create a file called 'composer.json' See this document "https://getcomposer.org/doc/00-intro.md#declaring-dependencies"

like image 32
SteveOfOz Avatar answered Sep 20 '22 08:09

SteveOfOz