How can I recreate composer.json from the content of the vendor directory? -


i have project using composer.

however, have lost composer.json.

is there way recreate composer.json content of vendor directory?

identifying installed dependencies can achieved inspecting

vendor └── composer     └── installed.json 

however, faced following problems:

direct , indirect dependencies

installed.json lists all installed dependencies, is, both

  • direct and
  • indirect

dependencies.

direct dependencies dependencies explicitly listed in require , require-dev sections.

indirect dependencies dependencies of direct dependencies.

that is, while programmatically parse installed.json , collect dependencies listed therein, need decide whether these direct or indirect dependencies, or in other words, whether want explicitly require these dependencies in composer.json.

production , development dependencies

installed.json lists all installed dependencies, is, depending on whether ran

$ composer install 

or

$composer install --no-dev 

before lost composer.json, installed.json contain direct , indirect dependencies listed in

  • require , require-dev or
  • require

sections, respectively.

that is, need decide whether these dependencies should listed in the

  • require or
  • require-dev

sections.

see

to find out more purpose , differences between these sections.

version constraints

installed.json lists all installed dependencies exact versions installed.

however, composer.json lost in likelihood did not list dependencies exact versions, using 1 of many possibilities specifying version constraints.

that is, need decide whether want use exact versions, or relax constraints, example, using

  • the ~ operator
  • the ^ operator
  • etc.

see

to find out more version constraints.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -