Reputation: 570
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!
Upvotes: 8
Views: 6028
Reputation: 13340
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
Upvotes: 14
Reputation: 168
composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 8 removals
- Removing yiisoft/yii2-jui (2.0.7)
- Removing bower-asset/jquery-ui (1.12.1)
- Removing phpoffice/phpspreadsheet (1.0.0)
- Removing psr/simple-cache (1.0.0)
- Removing guzzlehttp/guzzle (5.0.0)
- Removing guzzlehttp/ringphp (1.1.0)
- Removing guzzlehttp/streams (3.0.0)
- Removing react/promise (v2.5.1)
- Updating swiftmailer/swiftmailer (v5.4.8 => v5.4.9): Downloading (100%)
Writing lock file
Generating autoload files
I think you can execute composer update
, it will show you all packages, and then composer install ...
one by one
Upvotes: -1