PHP code example of aternos / licensee

1. Go to this page and download the library: Download aternos/licensee library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aternos / licensee example snippets


$licensee = new \Aternos\Licensee\Licensee();

$license = $licensee->findLicenseById('mit');
echo "Found " . $license->getTitle() . "\n";

$license = $licensee->findLicenseByTitle('MIT License');
echo "Found " . $license->getTitle() . "\n";

$content = new \Aternos\Licensee\License\Text\LicenseText(file_get_contents('LICENSE'), 'LICENSE');
$match = $licensee->findLicenseByContent($content);
echo "Found " . $match->getLicense()->getTitle() . "\n";
echo "Confidence: " . $match->getConfidence() . "\n";


$license = $licensee->findLicenseById('mit');

echo "Title: " . $license->getTitle() . "\n";
echo "ID: " . $license->getSpdxId()->value . "\n";
echo "Description: " . $license->getDescription() . "\n";
echo "How: " . $license->getHow() . "\n";

echo "Using:\n";
foreach ($license->getUsing() as $using) {
    echo "  - " . $using . "\n";
}

echo "Permissions:\n";
foreach ($license->getPermissions() as $permission) {
    echo "  - " . $permission->getLabel() . ": " . $permission->getDescription() . "\n";
}

echo "Conditions:\n";
foreach ($license->getConditions() as $condition) {
    echo "  - " . $condition->getLabel() . ": " . $condition->getDescription() . "\n";
}

echo "Limitations:\n";
foreach ($license->getLimitations() as $limitation) {
    echo "  - " . $limitation->getLabel() . ": " . $limitation->getDescription() . "\n";
}