PHP code example of isy-thl / european-learning-model
1. Go to this page and download the library: Download isy-thl/european-learning-model 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/ */
isy-thl / european-learning-model example snippets
use DateTimeImmutable;
use IsyThl\EuropeanLearningModel\Core\Concept;
use IsyThl\EuropeanLearningModel\Core\ConceptScheme;
use IsyThl\EuropeanLearningModel\Core\ElmVocabularySchemes;
use IsyThl\EuropeanLearningModel\Core\LocalizedString;
use IsyThl\EuropeanLearningModel\Edc\Claim;
use IsyThl\EuropeanLearningModel\Edc\Credential;
use IsyThl\EuropeanLearningModel\Edc\CredentialSubject;
use IsyThl\EuropeanLearningModel\Edc\DisplayParameter;
$english = new Concept(
'http://publications.europa.eu/resource/authority/language/ENG',
new LocalizedString(['en' => 'English']),
new ConceptScheme(ElmVocabularySchemes::LANGUAGE),
'ENG',
);
$subject = new CredentialSubject(
'subject-1',
new LocalizedString(['en' => 'Ada']),
new LocalizedString(['en' => 'Lovelace']),
new LocalizedString(['en' => 'Ada Lovelace']),
[new class ('claim-1') extends Claim {
public function toArray(): array {
return ['id' => $this->id, 'type' => 'Claim'];
}
}],
);
$credential = new Credential(
'credential-1',
$subject,
new DisplayParameter(
'display-1',
$english,
$english,
new LocalizedString(['en' => 'European Digital Credential']),
),
new DateTimeImmutable('2026-01-01T00:00:00+00:00'),
);
$unsignedJsonLd = $credential->toJson();
use IsyThl\EuropeanLearningModel\Loq\LoqDatasetDocument;
use IsyThl\EuropeanLearningModel\Loq\QualificationReference;
$reference = new QualificationReference($identifier, $datasetNamespace);
$dataset = new LoqDatasetDocument([$qualification, $learningOpportunity]);
$unsignedJsonLd = $dataset->toJson();
sh
ELM_LIVE_VOCABULARY_TESTS=1 vendor/bin/phpunit tests/LiveVocabularyTest.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.