Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the same a package.json and a composer.json?

Tags:

javascript

php

Hello i would like to know if a package.json is the same as a composer.json. I need to create one file with some content, i required to put it in a package.json file but in the project there is a composer.json already. So can i work in this file or they work diffent? Thanks

like image 503
Álvaro Avatar asked Jun 20 '17 14:06

Álvaro


2 Answers

They are not the same

  • package.json is a npm file to keep track of npm packages.
  • composer.json is a composer file to keep track of php packages.
like image 142
Giso Stallenberg Avatar answered Nov 04 '22 09:11

Giso Stallenberg


Best difference between composer.json & package.json file.

composer.json

  • Composer is a package manger tool for php.
  • composer.json manages the PHP dependencies.
  • For Example composer require fzaninotto/faker. This command will open and write to the composer.json file and download all the dependencies

package.json

  • package.json manages the Node dependencies.
  • All npm packages contain a file, usually in the project root, called package.json - this file holds various metadata relevant to the project. This file is used to give information to npm that allows it to identify the project as well as handle the project's dependencies.
like image 38
Mayank Dudakiya Avatar answered Nov 04 '22 07:11

Mayank Dudakiya