composer/spdx-licenses

SPDX licenses list and validation library.

Package info

github.com/composer/spdx-licenses

pkg:composer/composer/spdx-licenses

Fund package maintenance!

packagist.com

composer

Statistics

Installs: 192 134 134

Dependents: 26

Suggesters: 4

Stars: 1 389

Open Issues: 1

1.6.0 2026-04-08 20:18 UTC

Requires

  • php: ^7.2 || ^8.0

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 5ecd0cb4177696f9fd48f1605dda81db3dee7889

validatorlicensespdx


README

SPDX (Software Package Data Exchange) licenses list and validation library.

Originally written as part of composer/composer, now extracted and made available as a stand-alone library.

👁 Continuous Integration

Installation

Install the latest version with:

$ composer require composer/spdx-licenses

Basic Usage

<?php

use Composer\Spdx\SpdxLicenses;

$licenses = new SpdxLicenses();

// get a license by identifier
$licenses->getLicenseByIdentifier('MIT');

// get a license exception by identifier
$licenses->getExceptionByIdentifier('Autoconf-exception-3.0');

// get a license identifier by name
$licenses->getIdentifierByName('MIT License');

// check if a license is OSI approved by identifier
$licenses->isOsiApprovedByIdentifier('MIT');

// check if a license identifier is deprecated
$licenses->isDeprecatedByIdentifier('MIT');

// check if input is a valid SPDX license expression
$licenses->validate($input);

Read the specifications to find out more about valid license expressions.

Requirements

  • PHP 5.3.2 is required but using the latest version of PHP is highly recommended.

License

composer/spdx-licenses is licensed under the MIT License, see the LICENSE file for details.

Source

License information is curated by SPDX. The data is pulled from the License List Data repository.