Skip to content

SychO9/license-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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.