Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How recover composer.json by existing project on symfony2?

I have to work on a project on symphony 2 without composer's config, but with folders vendor/* in the repository.

I want to re-install the composer and generate a configuration for an existing package. Is it possible?

Thanks!

like image 918
Dmitry Avatar asked Mar 02 '15 14:03

Dmitry


1 Answers

You should create bare composer.json by hand or using command composer init.

And then you can list all the packages under the vendor folder by composer show --installed.

Then just generate require section for your composer.json with listed values. And you are done. You can use regular expressions to do it easier.

composer show --installed \
   | awk '{printf "\"%s\": \"^%s\",\n", $1, $2}' \
   | sed -r 's:\^v:^:g' \
   >> packages.list
like image 120
Michael Sivolobov Avatar answered Oct 16 '22 22:10

Michael Sivolobov