bclibraries / fulltext-finder
从引用中查找全文链接
v0.4.0
2022-07-28 21:54 UTC
Requires
- php: ^8.1
- ext-json: *
- bclibraries/libkey-client: ^v0.2.0
- nyholm/psr7: ^1.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- symfony/http-client: ^5.1
Requires (Dev)
- mockery/mockery: ^1.4.2
- php-http/mock-client: ^1.4.1
- phpunit/phpunit: ^9
README
FulltextFinder 是一个 PHP 库,用于从用户输入中查找文章全文版本的链接。
安装
使用包管理器 composer 安装 FulltextFinder。
composer init # Only necessary when starting a project from scratch.
composer require bclibraries/fulltext-finder:^0.1
FulltextFinder 目前是 0.* 版本,因此任何小版本发布都会带来很大的变化。
使用方法
use BCLib\FulltextFinder\Config; use BCLib\FulltextFinder\FullTextFinder; require_once __DIR__ . '/vendor/autoload.php'; # LibKey API identifiers. $libkey_apikey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'; $libkey_id = 'xxx'; $config = new Config(); $config->setUserAgent('MyApp/1.1 (https://mylibrary.college.edu/search; mailto:myapp.admin@cikkege.edu)') ->setFindByCitationMinLength(50); $finder = FullTextFinder::build($libkey_id, $libkey_apikey, $config); $response = $finder->find('Ben-Harush, A., Ezra-Shiovitz, S., Doron, I., Alon, S., Leibovitz, A., et al. (2017). Ageism among physicians, nurses, and social workers: findings from a qualitative study. European Journal of Ageing, 14(1), 39-48.'); echo "{$response->getTitle()}\n"; echo "\t{$response->getFullText()}\n";
配置
BCLib\FulltextFinder\Config
对象携带所有可选的 FullTextFinder 配置参数
运行测试
使用 PHPUnit 进行测试。您可能需要启用套接字扩展。
./vendor/bin/phpunit
贡献
欢迎拉取请求。对于重大更改,请先打开一个问题以讨论您希望更改的内容。
请确保适当地更新测试。