PHP Classes


Recommend this page to a friend!
  Classes of Sami Ilyes Mazouz   PHP License Detector   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP License Detector
Detect the type of project license text
Author: By
Last change:
Date: 3 years ago
Size: 1,542 bytes


Class file image Download


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

Travis (.org) branch Latest Version php License


Using Composer run the following

$ composer require sycho/license-detector


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.


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);


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

Example: Signed-off-by: Your Name <>


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