jamesfrost/wikidata
Composer 安装命令:
composer require jamesfrost/wikidata
包简介
A PHP client for working with Wikidata API.
README 文档
README
Wikidata provides a API for searching and retrieving data from wikidata.org.
Installation
composer require freearhey/wikidata
Usage
$wikidata = new Wikidata;
Search
Search by entity title:
$result = $wikidata->search('steve jobs');
Check if no search results
if($result->isEmpty()) { echo 'no results'; die(); }
Retrieve first entity in result list
$singleResult = $result->first();
Retrieve all results
$allResults = $result->get();
Get entity id
$entityId = $singleResult->getEntityId(); // Q26
Entities
Get single entity by id:
$entities = $wikidata->entities('Q26');
Get single entity with preset language (default: en)
$entities = $wikidata->entities('Q26', 'fr');
Get few entities by id and more languages
$entities = $wikidata->entities('Q26|Q106', 'en|fr|ch');
Retrieve first entity
$entity = $entities->first();
Get all entities
$entity = $entities->get();
Get single entity by id
$entity = $entities->get('Q26');
Get entity label and description (default language: en)
$label = $entity->getLabel(); // Steve Jobs $description = $entity->getDescription('de'); // US-amerikanischer Unternehmer, Mitbegründer von Apple Computer
Get entity property values by property id (e.g. P21) if it exists. All list properties you can find here
$gender = $entity->getPropertyValues('P21'); // array(1) { [0]=> string(4) "male" }
And with language property (default: en)
$childs = $entity->getPropertyValues('P40', 'ru'); // array(1) { [0]=> string(35) "Бреннан-Джобс, Лиза" }
That's all.
License
Wikidata is licensed under the MIT license
jamesfrost/wikidata 适用场景与选型建议
jamesfrost/wikidata 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.71k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 11 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「client」 「wikidata」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jamesfrost/wikidata 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jamesfrost/wikidata 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jamesfrost/wikidata 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Serializers and deserializers for the Wikibase DataModel
Services around the Wikibase DataModel
A PHP client for working with Wikidata API.
Adds the EDTF data type to Wikibase
Provides line-by-line readers and iterators for Wikibase/Wikidata JSON dumps
Mock PSR-18 HTTP client
统计信息
- 总下载量: 2.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-02