hbll-collection-development / scopus-api
Scopus API 的非官方 PHP SDK
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^7.0
- symfony/yaml: ^6.2
README
Scopus API 的非官方 PHP SDK
简介
实现了以下 Scopus API,如在此处所述: https://dev.elsevier.com/api_docs.html
- 机构搜索
- 作者搜索
- Scopus 搜索
- 摘要检索
- 机构检索
- 作者检索
- 引用计数元数据
- 引用概览
- 连续标题元数据
- 主题分类
目前,它只能搜索 API 并返回 JSON(或根据请求返回 XML)。未来的版本将实现解析和从 JSON 获取数据。
安装
使用 Composer
composer require hbll-collection-development/scopus-api
或者将以下内容添加到您的 composer.json 文件中
"require": { "hbll-collection-development/scopus-api": "^1.0" }
使用
对于所有 API 调用,您需要包含 Composer 自动加载文件
require_once 'path/to/vendor/autoload.php';
所有调用默认返回 JSON。
方法名称与 API 文档中概述的查询参数名称相对应,除非查询参数中有连字符。在这种情况下,方法使用下划线代替。可以链式调用查询参数的方法来构建完整的查询。
机构搜索
API 文档: https://api.elsevier.com/documentation/AffiliationSearchAPI.wadl
$affiliationSearch = new \Scopus\AffiliationSearch('API-KEY'); $results = $affiliationSearch ->query('AFFIL(Brigham Young University)') ->count(1) ->search();
如果您想返回 XML,可以这样做
$results = $affiliationSearch ->query('AFFIL(Brigham Young University)') ->count(1) ->httpAccept('application/xml') ->search();
示例 JSON 响应
{
"search-results": {
"opensearch:totalResults": "992",
"opensearch:startIndex": "0",
"opensearch:itemsPerPage": "1",
"opensearch:Query": {
"@role": "request",
"@searchTerms": "AFFIL(Brigham Young University)",
"@startPage": "0"
},
"link": [
{
"@_fa": "true",
"@ref": "self",
"@href": "https://api.elsevier.com/content/search/affiliation?start=0&count=1&query=AFFIL%28Brigham+Young+University%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
},
{
"@_fa": "true",
"@ref": "first",
"@href": "https://api.elsevier.com/content/search/affiliation?start=0&count=1&query=AFFIL%28Brigham+Young+University%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
},
{
"@_fa": "true",
"@ref": "next",
"@href": "https://api.elsevier.com/content/search/affiliation?start=1&count=1&query=AFFIL%28Brigham+Young+University%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
},
{
"@_fa": "true",
"@ref": "last",
"@href": "https://api.elsevier.com/content/search/affiliation?start=991&count=1&query=AFFIL%28Brigham+Young+University%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
}
],
"entry": [
{
"@_fa": "true",
"link": [
{
"@_fa": "true",
"@ref": "self",
"@href": "https://api.elsevier.com/content/affiliation/affiliation_id/60006832"
},
{
"@_fa": "true",
"@ref": "search",
"@href": "https://api.elsevier.com/content/search/scopus?query=af-id%2860006832%29"
},
{
"@_fa": "true",
"@ref": "scopus-affiliation",
"@href": "https://www.scopus.com/affil/profile.uri?afid=60006832&partnerID=HzOxMe3b&origin=inward"
}
],
"prism:url": "https://api.elsevier.com/content/affiliation/affiliation_id/60006832",
"dc:identifier": "AFFILIATION_ID:60006832",
"eid": "10-s2.0-60006832",
"affiliation-name": "Brigham Young University",
"name-variant": [
{
"@_fa": "true",
"$": "Brigham Young University"
}
],
"document-count": "29294",
"city": "Provo",
"country": "United States",
"parent-affiliation-id": "0"
}
]
}
}
作者搜索
API 文档: https://api.elsevier.com/documentation/AuthorSearchAPI.wadl
$authorSearch = new \Scopus\AuthorSearch('API-KEY'); $results = $authorSearch ->query('AUTHLASTNAME(Howland) AND AUTHFIRST(J) AND AF-ID(60006832)') ->search();
示例 JSON 响应
{
"search-results": {
"opensearch:totalResults": "1",
"opensearch:startIndex": "0",
"opensearch:itemsPerPage": "1",
"opensearch:Query": {
"@role": "request",
"@searchTerms": "AUTHLASTNAME(Howland) AND AUTHFIRST(J) AND AF-ID(60006832)",
"@startPage": "0"
},
"link": [
{
"@_fa": "true",
"@ref": "self",
"@href": "https://api.elsevier.com/content/search/author?start=0&count=25&query=AUTHLASTNAME%28Howland%29+AND+AUTHFIRST%28J%29+AND+AF-ID%2860006832%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
},
{
"@_fa": "true",
"@ref": "first",
"@href": "https://api.elsevier.com/content/search/author?start=0&count=25&query=AUTHLASTNAME%28Howland%29+AND+AUTHFIRST%28J%29+AND+AF-ID%2860006832%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
}
],
"entry": [
{
"@_fa": "true",
"link": [
{
"@_fa": "true",
"@ref": "self",
"@href": "https://api.elsevier.com/content/author/author_id/14071559700"
},
{
"@_fa": "true",
"@ref": "search",
"@href": "https://api.elsevier.com/content/search/author?query=au-id%2814071559700%29"
},
{
"@_fa": "true",
"@ref": "scopus-citedby",
"@href": "https://www.scopus.com/author/citedby.uri?partnerID=HzOxMe3b&citedAuthorId=14071559700&origin=inward"
},
{
"@_fa": "true",
"@ref": "scopus-author",
"@href": "https://www.scopus.com/authid/detail.uri?partnerID=HzOxMe3b&authorId=14071559700&origin=inward"
}
],
"prism:url": "https://api.elsevier.com/content/author/author_id/14071559700",
"dc:identifier": "AUTHOR_ID:14071559700",
"eid": "9-s2.0-14071559700",
"preferred-name": {
"surname": "Howland",
"given-name": "Jared L.",
"initials": "J.L."
},
"name-variant": [
{
"@_fa": "true",
"surname": "Howland",
"given-name": "Jared",
"initials": "J."
}
],
"document-count": "4",
"subject-area": [
{
"@abbrev": "SOCI",
"@frequency": "4",
"$": "Social Sciences (all)"
},
{
"@abbrev": "COMP",
"@frequency": "1",
"$": "Computer Science (all)"
}
],
"affiliation-current": {
"affiliation-url": "https://api.elsevier.com/content/affiliation/affiliation_id/60006832",
"affiliation-id": "60006832",
"affiliation-name": "Brigham Young University",
"affiliation-city": "Provo",
"affiliation-country": "United States"
}
}
]
}
}
Scopus 搜索
API 文档: https://api.elsevier.com/documentation/ScopusSearchAPI.wadl
$scopusSearch = new \Scopus\ScopusSearch('API-KEY'); $results = $scopusSearch ->query('TITLE(Tragedy of the Commons)') ->search();
示例 JSON 响应
{
"search-results": {
"opensearch:totalResults": "432",
"opensearch:startIndex": "0",
"opensearch:itemsPerPage": "1",
"opensearch:Query": {
"@role": "request",
"@searchTerms": "TITLE(Tragedy of the Commons)",
"@startPage": "0"
},
"link": [
{
"@_fa": "true",
"@ref": "self",
"@href": "https://api.elsevier.com/content/search/scopus?start=0&count=1&query=TITLE%28Tragedy+of+the+Commons%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
},
{
"@_fa": "true",
"@ref": "first",
"@href": "https://api.elsevier.com/content/search/scopus?start=0&count=1&query=TITLE%28Tragedy+of+the+Commons%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
},
{
"@_fa": "true",
"@ref": "next",
"@href": "https://api.elsevier.com/content/search/scopus?start=1&count=1&query=TITLE%28Tragedy+of+the+Commons%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
},
{
"@_fa": "true",
"@ref": "last",
"@href": "https://api.elsevier.com/content/search/scopus?start=431&count=1&query=TITLE%28Tragedy+of+the+Commons%29&apiKey=c29c9566c80d7b2dba4db28894ac26ce",
"@type": "application/json"
}
],
"entry": [
{
"@_fa": "true",
"link": [
{
"@_fa": "true",
"@ref": "self",
"@href": "https://api.elsevier.com/content/abstract/scopus_id/85028623301"
},
{
"@_fa": "true",
"@ref": "author-affiliation",
"@href": "https://api.elsevier.com/content/abstract/scopus_id/85028623301?field=author,affiliation"
},
{
"@_fa": "true",
"@ref": "scopus",
"@href": "https://www.scopus.com/inward/record.uri?partnerID=HzOxMe3b&scp=85028623301&origin=inward"
},
{
"@_fa": "true",
"@ref": "scopus-citedby",
"@href": "https://www.scopus.com/inward/citedby.uri?partnerID=HzOxMe3b&scp=85028623301&origin=inward"
}
],
"prism:url": "https://api.elsevier.com/content/abstract/scopus_id/85028623301",
"dc:identifier": "SCOPUS_ID:85028623301",
"eid": "2-s2.0-85028623301",
"dc:title": "An allometric tragedy of the commons: Response to the article “Evaluation of models capacity to predict size spectra parameters in ecosystems under stress”",
"dc:creator": "Mulder C.",
"prism:publicationName": "Ecological Indicators",
"prism:issn": "1470160X",
"prism:volume": "84",
"prism:pageRange": "161-164",
"prism:coverDate": "2018-01-01",
"prism:coverDisplayDate": "January 2018",
"prism:doi": "10.1016/j.ecolind.2017.08.042",
"pii": "S1470160X17305320",
"citedby-count": "0",
"affiliation": [
{
"@_fa": "true",
"affilname": "National Institute of Public Health and the Environment",
"affiliation-city": "Bilthoven",
"affiliation-country": "Netherlands"
}
],
"prism:aggregationType": "Journal",
"subtype": "le",
"subtypeDescription": "Letter",
"source-id": "20292"
}
]
}
}
摘要检索
API 文档: https://api.elsevier.com/documentation/AbstractRetrievalAPI.wadl
$abstractRetrieval = new \Scopus\AbstractRetrieval('SCOPUS-ID', 'scopusId', 'API-KEY'); $results = $abstractRetrieval ->field('url,identifier,description') ->search();
其他选项包括
$abstractRetrieval = new \Scopus\AbstractRetrieval('EID', 'eid', 'API-KEY'); $abstractRetrieval = new \Scopus\AbstractRetrieval('DOI', 'doi', 'API-KEY'); $abstractRetrieval = new \Scopus\AbstractRetrieval('PII', 'pii', 'API-KEY'); $abstractRetrieval = new \Scopus\AbstractRetrieval('PUBMED-ID', 'pubmedId', 'API-KEY'); $abstractRetrieval = new \Scopus\AbstractRetrieval('PUI', 'pui', 'API-KEY');
例如
$abstractRetrieval = new \Scopus\AbstractRetrieval('85028623301', 'scopusId', 'API-KEY');
示例 JSON 响应
{
"abstracts-retrieval-response": {
"coredata": {
"prism:url": "https://api.elsevier.com/content/abstract/scopus_id/85028623301",
"dc:identifier": "SCOPUS_ID:85028623301",
"link": [
{
"@href": "https://api.elsevier.com/content/abstract/scopus_id/85028623301",
"@rel": "self",
"@_fa": "true"
}
]
}
}
}
其他
有关其他 API 如何由非官方 SDK 支持的信息和提示,请参阅 Scopus API 文档页面(https://dev.elsevier.com/api_docs.html)。