arteq / lift
0.1.2
2019-07-31 09:31 UTC
Requires (Dev)
- phpunit/phpunit: ^5.7
- vimeo/psalm: ^0
This package is auto-updated.
Last update: 2025-03-29 01:00:27 UTC
README
Biblioteka umożliwia wygenerowanie uproszczonego słownika w formacie LIFT (XML).
Instalacja
$ composer require arteq/lift
Opcjonalnie można przeprowadzić testy:
$ vendor/bin/phpunit
Tworzenie słownika
<?php
use ArteQ\LIFT\Dictionary;
use ArteQ\LIFT\Term;
use ArteQ\LIFT\Translation;
require __DIR__.'/../vendor/autoload.php';
// create dictionary
$dict = new Dictionary();
// create first english term, with autogenerated id
$term = new Term('word', 'en');
// create translation
$translation = new Translation('słowo', 'pl');
$translation->addNote('Dodatkowa notatka');
$translation->addDefinition('Definicja encyklopedyczna');
$translation->addExample('Przykład użycia', 'de');
// add translation to term
$term->addTranslation($translation);
// add term to dictionary
$dict->addTerm($term);
// generate XML & display
$xml = $dict->generate();
echo $xml;
// generate XML and save to file
$dict->save('/file/path/dict.lift');