{"id":48648868,"url":"https://github.com/aternosorg/php-licensee","last_synced_at":"2026-04-10T08:26:30.690Z","repository":{"id":268877668,"uuid":"905730355","full_name":"aternosorg/php-licensee","owner":"aternosorg","description":"A library to detect well-known licenses based on their title or content.","archived":false,"fork":false,"pushed_at":"2025-11-27T11:21:30.000Z","size":531,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-11T10:24:35.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aternosorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-19T12:09:46.000Z","updated_at":"2025-11-27T11:21:12.000Z","dependencies_parsed_at":"2024-12-19T13:25:10.626Z","dependency_job_id":"9e5baba1-2f7e-49d9-b711-9728960e6928","html_url":"https://github.com/aternosorg/php-licensee","commit_stats":null,"previous_names":["aternosorg/php-licensee"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/aternosorg/php-licensee","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-licensee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-licensee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-licensee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-licensee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aternosorg","download_url":"https://codeload.github.com/aternosorg/php-licensee/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fphp-licensee/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31634829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-10T08:26:27.482Z","updated_at":"2026-04-10T08:26:30.682Z","avatar_url":"https://github.com/aternosorg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# PHP-Licensee\n\nThis library can be used to detect well-known licenses based on their title or content.\nPHP-Licensee is based on the [Licensee Ruby Gem](https://github.com/licensee/licensee), but not quite a full port.\n\nInformation about licenses is generated from data from [choosealicense.com](https://github.com/github/choosealicense.com)\nand the [SPDX License List](https://github.com/spdx/license-list-XML).\nNote that only licenses that are listed on choosealicense.com can be detected by this library.\n\n## Installation\n\n```shell\ncomposer require aternos/licensee\n```\n\n## Usage\n\n```php\n$licensee = new \\Aternos\\Licensee\\Licensee();\n```\n\n### Detect license by ID string\n\n```php\n$license = $licensee-\u003efindLicenseById('mit');\necho \"Found \" . $license-\u003egetTitle() . \"\\n\";\n```\n\n### Detect license by title\n\n```php\n$license = $licensee-\u003efindLicenseByTitle('MIT License');\necho \"Found \" . $license-\u003egetTitle() . \"\\n\";\n```\n\nSetting the optional argument `allowMatchWithoutVersion` to `true` will allow the detection of licenses\nwithout considering the version number, in case no exact match can be found.\n\n### Detect license by content\n\n```php\n$content = new \\Aternos\\Licensee\\License\\Text\\LicenseText(file_get_contents('LICENSE'), 'LICENSE');\n$match = $licensee-\u003efindLicenseByContent($content);\necho \"Found \" . $match-\u003egetLicense()-\u003egetTitle() . \"\\n\";\necho \"Confidence: \" . $match-\u003egetConfidence() . \"\\n\";\n```\n\nThis will try to find a license that is an exact match ([after some normalization steps](src/TextTransformer)),\nor use a version of the [Dice-Sørensen coefficient](https://en.wikipedia.org/wiki/Dice-S%C3%B8rensen_coefficient).\n\nOptionally, a `confidenceThreshold` value between 0 and 100 can be supplied to `findLicenseByContent`.\nIf not set, the default value of 98.0 will be used.\n\n### Get license information\n\nMost of the information available on choosealicense.com can be accessed through the license object:\n\n```php\n\n$license = $licensee-\u003efindLicenseById('mit');\n\necho \"Title: \" . $license-\u003egetTitle() . \"\\n\";\necho \"ID: \" . $license-\u003egetSpdxId()-\u003evalue . \"\\n\";\necho \"Description: \" . $license-\u003egetDescription() . \"\\n\";\necho \"How: \" . $license-\u003egetHow() . \"\\n\";\n\necho \"Using:\\n\";\nforeach ($license-\u003egetUsing() as $using) {\n    echo \"  - \" . $using . \"\\n\";\n}\n\necho \"Permissions:\\n\";\nforeach ($license-\u003egetPermissions() as $permission) {\n    echo \"  - \" . $permission-\u003egetLabel() . \": \" . $permission-\u003egetDescription() . \"\\n\";\n}\n\necho \"Conditions:\\n\";\nforeach ($license-\u003egetConditions() as $condition) {\n    echo \"  - \" . $condition-\u003egetLabel() . \": \" . $condition-\u003egetDescription() . \"\\n\";\n}\n\necho \"Limitations:\\n\";\nforeach ($license-\u003egetLimitations() as $limitation) {\n    echo \"  - \" . $limitation-\u003egetLabel() . \": \" . $limitation-\u003egetDescription() . \"\\n\";\n}\n\n```\n\n## Key differences to Ruby Licensee\n\n### No projects\n\nThis library does not automatically scan project directories for license files or package metadata.\nFinding the correct license file is up to the user.\n\n### No pseudo licenses\n\nRuby Licensee can return the pseudo licenses `other` and `no-license` if no license could be detected.\nThis library will simply return `null` in this case.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fphp-licensee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faternosorg%2Fphp-licensee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fphp-licensee/lists"}