https://github.com/sycho9/license-detector
📜 A license information detector
https://github.com/sycho9/license-detector
composer license license-detector php similarity-measures
Last synced: 3 months ago
JSON representation
📜 A license information detector
- Host: GitHub
- URL: https://github.com/sycho9/license-detector
- Owner: SychO9
- License: mit
- Created: 2019-08-23T09:50:37.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-28T20:46:08.000Z (about 6 years ago)
- Last Synced: 2024-10-14T10:45:13.229Z (about 1 year ago)
- Topics: composer, license, license-detector, php, similarity-measures
- Language: PHP
- Homepage:
- Size: 144 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# license-detector
A License information detector, inspired by [Licensee](https://github.com/licensee/licensee) and relies on data from [`choosealicense.com`](https://choosealicense.com/)




## Installation
Using Composer run the following
```gitattributes
$ 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
```php
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 `
## License
This package is released under the MIT License. A full copy of this license is included in the package file.