PHP Classes

PHP License Detector: Detect the type of project license text

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 115 All time: 9,574 This week: 50Up
Version License PHP version Categories
license-detector 1.0MIT/X Consortium ...5PHP 5, Tools, Text processing, Artifi..., P...
Description 

Author

This package can detect the type of project license text.

It can take as parameters the text of a license given in the format of a string or a file that contains the license text.

The package can detect the type of license by checking the similarity of the text of the given license with other well known types of license provided by this package as license files.

Innovation Award
PHP Programming Innovation award nominee
August 2019
Number 9
There are many types of licenses being used by software projects to distribute their code and other types of files. Some of those licenses are just variants of each other.

This package can be used to analyse a license text and detect its type of license comparing with a list of well known licenses that are more popular and are provided withing the package.

Manuel Lemos
Picture of Sami Ilyes Mazouz
  Performance   Level  
Innovation award
Innovation award
Nominee: 1x

 

Documentation

license-detector

A License information detector, inspired by Licensee and relies on data from choosealicense.com

Travis (.org) branch Latest Version php License

Installation

Using Composer run the following

$ composer require sycho/license-detector

Problem

The code uses php's similar_text() function to tell which license is the one used, the function is quiet expensive and can take up to one second for the results.

Usage

Using the Detector class's parse() or parseByPath() methods, you get a License object containing data about the license

require '...\vendor\autoload.php';

use LicenseDetector\Detector;

$detector = new Detector();

// By license contents
$license = $detector->parse($contents);

// By file path
$license = $detector->parseByPath($path_to_license);

Contributing

Sign-off your commits, to acknowledge your submission under the license of the project.

Example: Signed-off-by: Your Name <youremail@example.com>

License

This package is released under the MIT License. A full copy of this license is included in the package file.


  Files folder image Files (51)  
File Role Description
Files folder imagelicense-detector (4 files)
Files folder imagetests (2 files)
Files folder imagevendor (1 directory)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:115
This week:0
All time:9,574
This week:50Up