skoro/stardict

提供对StarDict词典的接口。

0.2.1 2023-06-29 17:43 UTC

This package is auto-updated.

Last update: 2024-08-29 20:30:13 UTC


README

提供PHP接口访问StarDict词典。

通过composer安装

composer require skoro/stardict

使用方法

use StarDict\StarDict;

require dirname(__FILE__) . '/vendor/autoload.php';

$dict = StarDict::createFromFiles('dict.ifo', 'dict.idx', 'dict.dict.dz');

echo $dict->getDict()->getBookname(); // show dict name.

foreach ($dict->get('word') as $result) {
    echo $result->getValue();
}

注意事项

  • 仅支持2.4.2版本的StarDict。
  • 必须指定且不能为空的选项sametypesequence