vvoleman/zotero-php-wrapper
Composer 安装命令:
composer require vvoleman/zotero-php-wrapper
包简介
Zotero API wrapper for PHP
README 文档
README
PHP wrapper for citation software Zotero
Features
Object-oriented approach. Since I don't know the full scale of API, I can painlessly add new endpoints and stuffs
Installation
composer require vvoleman/zotero-php-wrapper
Usage
Connect to Zotero
To use Zotero's API, you need to generate API key.
Get API key
Log into your Zotero account and access Feeds/API part of profile settings and click Create new private key.
Next, you can specify what permissions will this API key have. Save your API key, since you won't be able to retrieve it after you leave this page.
Create instance
Hop into your code and create some whooshing wrapper instance.
$api = new ZoteroApi("YOUR_API_KEY",new KeysSource("YOUR_API_KEY")); $api->run(); $data = $api->getBody();
Let's explain it a bit.
ZoteroApi instance requires API key for authentication and source.
Source is main branch from which we want to retrieve our data. So far, there are:
-
UsersSource/GroupSource- All your precious collections and items are linked to a user or to group. Working with both them is a same.
- After you create your
UsersSource/GroupSourceinstance, you set endpoints to them withZoteroApi::setEndpoint(), which takes as a parameter instance of AbstractEndpoint
$api = new ZoteroApi($_ENV["API_KEY"], new UsersSource("YOUR_USER_ID")); $api->setEndpoint( (new Collections("COLLECTION_ID")) ->setEndpoint(new Items(AbstractEndpoint::ALL)) );
- AbstractEndpoint can chain another AbstractEndpoint - think of it like you can add
/itemsto/collections/ID. However, there are limits to chaining. You can't add/itemsto/collections- you have to specify specific collection. - So, here are possible chainings (not all, but you get the idea):
Collections("ID")->Items(<All options>)Collections("ID")->Items("ID")->Tags("ID")Collections("ID")->Items("ID")->Tags(AbstractEndpoint::ALL)
- AbstractEndpoint takes as a constructor parameter a string value that specifies what you want to search
AbstractEndpoint::ALL- All resultsAbstractEndpoint::TOP- Top-level results onlyAbstractEndpoint::TRASH- Results in trash"ID"- Specific ID of Endpoint
vvoleman/zotero-php-wrapper 适用场景与选型建议
vvoleman/zotero-php-wrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 36 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 03 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vvoleman/zotero-php-wrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vvoleman/zotero-php-wrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 36
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-03-27