Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mtarld/composer-vendor-scraper
A simple CLI command that scraps your composer vendor folder
https://github.com/mtarld/composer-vendor-scraper
composer scraper
Last synced: 12 days ago
JSON representation
A simple CLI command that scraps your composer vendor folder
- Host: GitHub
- URL: https://github.com/mtarld/composer-vendor-scraper
- Owner: mtarld
- Created: 2020-11-30T17:43:39.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-01T08:31:55.000Z (over 3 years ago)
- Last Synced: 2024-10-05T19:08:05.987Z (about 1 month ago)
- Topics: composer, scraper
- Language: PHP
- Homepage:
- Size: 248 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# Composer vendor scraper
Have you ever been stuck with a vendor folder but without composer.json and composer.lock files?
Hope you don't! But, don't ask me why, sometimes it just happens...Then, here comes the Composer vendor scraper!
## A simple CLI command
The Composer vendor scraper is a simple CLI command that scraps your `vendor` folder in order to
generate a `composer.json` file that fit with the original `vendor` folder.This command cannot regenerate the exact original `composer.json` file but can generate one
that just works and that you'll be able to modify according to your needs.## Cookbook
### Installation
You can easily install Composer vendor scraper using `curl`:
```
$ curl -o- https://raw.githubusercontent.com/mtarld/composer-vendor-scraper/master/bin/composer-vendor-scraper.phar > composer-vendor-scraper.phar
```### Usage
Once the command installed, you could use it that way:```bash
$ php composer-vendor-scraper.pharDescription:
Recreate a composer.json file from a vendor directoryUsage:
bin/composer-vendor-scraper.phar [options] [--] []Arguments:
vendor Vendor directory path [default: "vendor"]Options:
--require-all Add every package to require
--require-root-only Add only packages that are not dependency of other packages to require
--version-strategy=VERSION-STRATEGY Version strategy (fixed, patch, minor, major)
--out-file=OUT-FILE Generated file path [default: "composer.json"]
-h, --help Display help for the given command. When no command is given display help for the bin/composer-vendor-scraper.phar commandHelp:
To know which version strategy to use, have a look at https://semver.org/
```
## Example
```bash
php composer-vendor-scraper.phar
Vendor scrapper
===============
Root packages
----------------- ---------
Name Version
----------------- ---------
symfony/console v5.2.0
symfony/finder v5.2.0
----------------- ---------Dependency packages
---------------------------------- ---------
Name Version
---------------------------------- ---------
psr/container 1.0.0
symfony/service-contracts v2.2.0
symfony/string v5.2.0
---------------------------------- ---------Would you like to add dependency packages to required packages? (yes/no) [no]:
> yesSelect dependency packages to add to root packages:
[0] psr/container
[1] symfony/service-contracts
[2] symfony/string
> symfony/stringRequired packages
----------------- ---------
Name Version
----------------- ---------
symfony/console v5.2.0
symfony/finder v5.2.0
symfony/string v5.2.0
----------------- ---------Required packages
----------------- ---------
Name Version
----------------- ---------
symfony/console v5.2.0
symfony/finder v5.2.0
symfony/string v5.2.0
----------------- ---------Choose a version strategy for symfony/console [fixed]:
[0] fixed
[1] patch
[2] minor
[3] major
> patchChoose a version strategy for symfony/finder [fixed]:
[0] fixed
[1] patch
[2] minor
[3] major
> minorChoose a version strategy for symfony/string [fixed]:
[0] fixed
[1] patch
[2] minor
[3] major
> majorResult
----------------- ----------
Name Version
----------------- ----------
symfony/console ~5.2.0.0
symfony/finder ~5.2.0
symfony/string ~5.2
----------------- ----------Proceed? (yes/no) [yes]:
> yes[OK] composer.json successfully created! Feel free to modify it!
```## Contributing
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.After writing your fix/feature, you can run following commands in order to generate the updated PHAR.
```bash
# Install dev dependencies
$ composer install# Build the new PHAR
$ composer build-phar
```## Authors
- Mathias Arlaud - [mtarld](https://github.com/mtarld) -