meesterdev/package-parser

Parse composer/npm package locks into a list of packages with some basic information.

1.1.0 2023-11-06 14:31 UTC

This package is auto-updated.

Last update: 2024-05-06 15:32:54 UTC


README

Parses composer.json/composer.lock and package.json/package-lock.json files for retrieving information about licenses from those packages.

Packages can be skipped based on their license and will be added to a list of "failed packages" if no license information is available. No validity checks are done on the license itself (e.g. whether it appears on the SPDX License List).

Example

<?php

use MeesterDev\PackageParser\Parsers\ParserFactory;

$parser = ParserFactory::createForFilePath('composer.json');
$parser->ignoreLicenses(['proprietary', 'UNLICENSED']);
$packages = $parser->parse();

var_dump($packages, $factory->skippedPackages, $factory->failedPackages); // probably a pretty long dump