Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
1f03214
Bump GuzzleHttp to the latest version
matasarei May 14, 2023
9fd5b22
Institusion token support added
matasarei May 14, 2023
8fd17b7
Docs updated
matasarei May 14, 2023
b6e8ccf
Changelog updated
matasarei May 14, 2023
e87a29b
Readme updated
matasarei May 14, 2023
4dbcbf3
security: update guzzle to ^7.15.2 to fix SSRF vulnerability
matasarei Sep 1, 2026
7430f0b
security: allow guzzle 8.0.1+ for wider library compatibility
matasarei Sep 1, 2026
89551a3
Merge pull request #1 from grinchenkoedu/fix/update-guzzle-vulnerability
matasarei Sep 1, 2026
66b967f
chore: prepare for packagist registration (name, authors, psr-4)
matasarei Sep 1, 2026
90c56de
docs: extract changelog to dedicated CHANGELOG.md and update README
matasarei Sep 1, 2026
2da526e
docs: modernize CHANGELOG.md to Keep a Changelog format
matasarei Sep 1, 2026
702e257
docs: improve README.md with badges, requirements, and standard struc…
matasarei Sep 1, 2026
db0a403
chore: complete docs-best-practices task
matasarei Sep 1, 2026
8231907
build: bump PHP requirement to 7.4 and remove .tasks directory
matasarei Sep 1, 2026
99a228e
docs: remove downloads badge and add contributors block
matasarei Sep 1, 2026
db4633f
build: revert PHP requirement back to 7.2
matasarei Sep 1, 2026
f6ba5d4
Merge pull request #2 from grinchenkoedu/feature/docs-best-practices
matasarei Sep 1, 2026
7ff9ff9
docs: refine contributors wording
matasarei Sep 1, 2026
b8c3b14
docs: update API documentation link to point to GitHub Pages
matasarei Sep 1, 2026
02f5d98
chore: release v1.4.1
matasarei Sep 1, 2026
5ca1adf
docs: refine historical changelog entries
matasarei Sep 1, 2026
a4fe424
ci: add GitHub Actions matrix for PHP 7.4 to 8.5
matasarei Sep 1, 2026
9c3f79d
ci: add step to run test.php
matasarei Sep 1, 2026
0fc785b
test: handle invalid API key exception gracefully
matasarei Sep 1, 2026
3dde2f3
test: set up PHPUnit and add initial unit test
matasarei Sep 1, 2026
8e09a6e
docs: add GitHub Actions CI badge to README
matasarei Sep 1, 2026
7ad2e80
chore: ignore .tasks directory
matasarei Sep 1, 2026
5ba08b3
test: configure code coverage in phpunit.xml.dist
matasarei Sep 1, 2026
c0b2a38
test: add base TestCase with Guzzle MockHandler
matasarei Sep 1, 2026
14ce1f5
test: add SearchQueryTest
matasarei Sep 1, 2026
d833b5f
test: add ScopusApiTest for limit checks and JSON parsing
matasarei Sep 1, 2026
e4a752c
test: add Response DTO tests
matasarei Sep 1, 2026
2d8e592
test: add XmlUtilTest and fix PHP 8+ each() deprecation
matasarei Sep 1, 2026
b8e84a2
test: add AuthorTest to complete response tests
matasarei Sep 1, 2026
60f060a
fix: apply test coverage improvements and sparse data checks
matasarei Sep 1, 2026
fbd6a38
Merge pull request #4 from grinchenkoedu/feature/unit-testing
matasarei Sep 1, 2026
44bbf5b
docs: refine title and clarify third party status
matasarei Sep 1, 2026
bf82fa5
chore: ignore local .claude tooling directory
matasarei Sep 1, 2026
539ae7f
fix: internalise libxml errors when parsing XML responses
matasarei Sep 1, 2026
308516c
test: keep phpunit.xml.dist valid across PHPUnit 8.5-11
matasarei Sep 1, 2026
51515f7
fix: declare nullable parameters explicitly
matasarei Sep 1, 2026
1fcc2e0
fix: return null instead of warning for missing response keys
matasarei Sep 1, 2026
7943c5f
ci: test the PHP floor the package actually declares
matasarei Sep 1, 2026
dfcacb6
chore: remove the manual test/test.php script
matasarei Sep 1, 2026
d5c714b
build: exclude development files from the distributed package
matasarei Sep 1, 2026
4c12658
test: give every test case one base class
matasarei Sep 1, 2026
bad6539
docs: record the testing and CI work in the changelog
matasarei Sep 1, 2026
97eb0c1
docs: fix the broken badges and lead with CI
matasarei Sep 1, 2026
4a07be9
Fix: guard AuthorProfile::getAffiliationCurrent() against a missing key
matasarei Sep 1, 2026
9d18e62
Fix: guard the nested key in getAffiliationHistory() and getSubjectAr…
matasarei Sep 1, 2026
9ebda36
Fix: guard the sub-keys the prepare* helpers read
matasarei Sep 1, 2026
4aef463
Fix: stop CitationCount::getStatus() failing on a missing @status
matasarei Sep 1, 2026
84b4651
Fix: assert what getStatus() actually returns
matasarei Sep 1, 2026
35ca658
Fix: fail the suite on PHP warnings
matasarei Sep 1, 2026
a8f1358
Fix: replace the API key in the README example with a placeholder
matasarei Sep 1, 2026
95725b2
Fix: stop discarding libxml errors the caller was collecting
matasarei Sep 1, 2026
bf97f05
Fix: cover the XML error paths that had no test
matasarei Sep 1, 2026
2a325b1
Fix: exclude .gitignore from the distributed package too
matasarei Sep 1, 2026
e20356c
build: require PHP 7.4, dropping 7.2 and 7.3
matasarei Sep 1, 2026
ca15911
Merge pull request #5 from grinchenkoedu/fix/ci-xml-warnings-and-cleanup
matasarei Sep 1, 2026
4a01cd0
Fix: keep the guzzle 7 branch of the constraint under test
matasarei Sep 1, 2026
30a57b8
Fix: bound the PHP constraint instead of leaving it open-ended
matasarei Sep 1, 2026
8f780c5
Fix: order the changelog sections as Keep a Changelog specifies
matasarei Sep 1, 2026
ddf2e9a
Fix: state the reason for the PHP bump in terms a reader can check
matasarei Sep 1, 2026
d29777a
Merge pull request #6 from grinchenkoedu/build/require-php-74
matasarei Sep 1, 2026
1d73290
docs: cut the 1.5.0 changelog section
matasarei Sep 1, 2026
23cd052
refactor: state the null return explicitly in 21 getters
matasarei Sep 2, 2026
97ed835
chore: add keywords, homepage and support links to composer.json
matasarei Sep 2, 2026
5b1f5d9
docs: record 1.4.2 and add the changelog compare links
matasarei Sep 2, 2026
c8455df
docs: regenerate the API documentation
matasarei Sep 2, 2026
0499c28
ci: fail the build when docs/ drifts from src/
matasarei Sep 2, 2026
9a039ca
ci: regenerate docs/ automatically instead of gating on it
matasarei Sep 2, 2026
063bdae
Merge pull request #7 from grinchenkoedu/ci/docs-drift
matasarei Sep 2, 2026
44a1641
docs: regenerate API documentation
github-actions[bot] Sep 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Keep the distributed package to the code consumers actually need.
# Without this, `composer require` pulls the whole generated docs site
# (~120 HTML files), the test suite and the CI config into vendor/.
/docs export-ignore
/tests export-ignore
/.github export-ignore
/phpunit.xml.dist export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
dependencies: ['highest']
include:
# Guzzle 8 wins on every supported PHP, so without this leg the
# ^7.15.2 half of the guzzle constraint is never exercised.
- php-version: '7.4'
dependencies: 'lowest'

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: composer:v2

- name: Validate composer.json
run: composer validate --strict

- name: Install dependencies
run: composer update --prefer-dist --no-progress ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }}

- name: Lint PHP files
run: find src tests -name "*.php" -print0 | xargs -0 -n1 php -l

- name: Run tests
run: vendor/bin/phpunit
65 changes: 65 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Docs

# CI is the only thing that generates docs/. That is deliberate: ApiGen lists
# implementing classes in filesystem order without sorting them, so the same
# source produces different output on macOS and Linux. Keeping generation on one
# platform makes the result reproducible; regenerating by hand reintroduces the
# churn. docs/** is not a trigger, so the commit below cannot retrigger this.
on:
push:
branches: [ "master" ]
paths:
- 'src/**'
- 'composer.json'
- '.github/workflows/docs.yml'
workflow_dispatch:

permissions:
contents: write

concurrency:
group: docs
cancel-in-progress: false

jobs:
regenerate:
name: Regenerate API documentation
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
tools: composer:v2

- name: Install dependencies
run: composer update --prefer-dist --no-progress

- name: Download ApiGen
run: curl -sSfL -o apigen.phar https://github.com/ApiGen/ApiGen/releases/download/v7.0.0-alpha.6/apigen.phar

- name: Regenerate
# --workers 1 is required: the parallel scheduler crashes when ApiGen runs
# from a PHAR.
run: |
php apigen.phar --workers 1 --output docs \
--title "Scopus API for PHP" \
--base-url "https://grinchenkoedu.github.io/scopus-api-php/" \
src

- name: Commit if it changed
run: |
if git diff --quiet -- docs; then
echo "docs/ is already up to date."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add docs
git commit -m "docs: regenerate API documentation"
git push
echo "Regenerated docs/ and pushed."
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ composer.phar
composer.lock
composer-test.lock
vendor/
.idea
.idea
.tasks/
.claude/
97 changes: 97 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.5.0] - 2026-09-02

### Added
- PHPUnit test suite covering the API client, the query builder, the response DTOs and the XML
utility, using Guzzle's `MockHandler` so no test touches the network.
- GitHub Actions CI running the suite on PHP 7.4 through 8.5.
- `.gitattributes`, so the distributed package no longer ships `docs/`, `tests/` and the CI config.

### Changed
- The minimum PHP version is now 7.4, up from 7.2, and the constraint is bounded at
`^7.4 || ^8.0`. PHP 7.2 and 7.3 reached end of life in November 2020 and December 2021.
Supporting them forced `require-dev` to span PHPUnit 8.5 to 11 and split the dependency graph
across two Guzzle majors. No public API changed: projects still on PHP 7.2 or 7.3 keep
resolving to 1.4.1 rather than failing to install.

### Removed
- `docs/`, `tests/` and the CI configuration are no longer part of the distributed package, and
the manual `test/test.php` script is gone. Nothing under `vendor/` should have referenced them,
but the paths do disappear.

### Fixed
- `XmlUtil::toArray()` no longer calls `each()`, which was removed in PHP 8.
- XML parse failures no longer emit raw PHP warnings, and no longer crash when
`libxml_get_last_error()` returns `false`.
- Getters in `Scopus\Response` return `null` for a missing key instead of raising
`Undefined array key`; Scopus routinely omits fields.
- Nullable parameters are declared explicitly, clearing the PHP 8.4 deprecation.

## [1.4.2] - 2026-09-01

Maintenance release on the `1.4.x` branch, for PHP 7.2 and 7.3, which cannot install 1.5.0.
Same fixes as 1.5.0, cut before the PHP requirement moved to 7.4.

## [1.4.1] - 2026-09-01

### Changed
- Prepared for Packagist: updated package name to `grinchenkoedu/scopus-search-api`.
- Added Yevhen Matasar to the authors list.
- Upgraded Composer autoloading to PSR-4.

### Security
- Fixed SSRF vulnerability by updating the `guzzlehttp/guzzle` requirement to `^7.15.2 || ^8.0.1`.

## [1.4.0] - 2023-05-14

### Added
- Added institution token support.

### Changed
- Updated `guzzlehttp/guzzle` to the latest version (7.6).
- Restored `retrieve` and `query` methods back to `public` visibility.

## [1.3.0] - 2022-05-01

### Added
- Added Abstract Citations Count API.

## [1.2.0] - 2021-11-14

### Added
- Added `hasError` method for better error handling.

### Changed
- Bumped `guzzlehttp/guzzle` version constraint to `>=6.3`.

### Fixed
- Fixed year parsing in the `getYear` method.

## [1.1.0] - 2020-05-19

### Added
- Added Search Author API.
- Added Citation Overview API (including fetching multiple documents).
- Added `openaccessFlag` to the `Entry` class.
- Created a support function to retrieve documents of a specific author easily.
- Generated initial API documentation using ApiGen.

### Changed
- Updated various classes (`AbstractCitations`, `Source`, etc.) for better compatibility.

[Unreleased]: https://github.com/grinchenkoedu/scopus-api-php/compare/1.5.0...HEAD
[1.5.0]: https://github.com/grinchenkoedu/scopus-api-php/compare/1.4.2...1.5.0
[1.4.2]: https://github.com/grinchenkoedu/scopus-api-php/compare/1.4.1...1.4.2
[1.4.1]: https://github.com/grinchenkoedu/scopus-api-php/compare/1.4.0...1.4.1
[1.4.0]: https://github.com/grinchenkoedu/scopus-api-php/compare/1.3.0...1.4.0
[1.3.0]: https://github.com/grinchenkoedu/scopus-api-php/compare/1.2.0...1.3.0
[1.2.0]: https://github.com/grinchenkoedu/scopus-api-php/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/grinchenkoedu/scopus-api-php/releases/tag/1.1.0
82 changes: 65 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Scopus API for PHP (Unofficial)
# Scopus API for PHP

PHP SDK for [Scopus APIs](https://dev.elsevier.com/scopus.html)
[![CI](https://github.com/grinchenkoedu/scopus-api-php/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/grinchenkoedu/scopus-api-php/actions/workflows/ci.yml)
[![Latest Stable Version](https://img.shields.io/packagist/v/grinchenkoedu/scopus-search-api)](https://packagist.org/packages/grinchenkoedu/scopus-search-api)
[![PHP Version Require](https://img.shields.io/packagist/php-v/grinchenkoedu/scopus-search-api)](https://packagist.org/packages/grinchenkoedu/scopus-search-api)
[![License](https://img.shields.io/packagist/l/grinchenkoedu/scopus-search-api)](https://packagist.org/packages/grinchenkoedu/scopus-search-api)

Currently, supported APIs:
A third party PHP SDK for [Scopus APIs](https://dev.elsevier.com/scopus.html).

Currently supported APIs:
- Scopus Search API
- Abstract Retrieval API
- Author Retrieval API
Expand All @@ -11,18 +16,28 @@ Currently, supported APIs:
- Citation Overview API
- Abstract Citations Count API

## Requirements

- PHP 7.4 – 8.x
- `guzzlehttp/guzzle` ^7.15.2 || ^8.0.1

## Installation

`composer require kasparsj/scopus-search-api`
Install the package via Composer:

## Usage:
```bash
composer require grinchenkoedu/scopus-search-api
```

## Usage

```php
use Scopus\ScopusApi;
use Scopus\ScopusApiFactory;

// replace with your API key
$apiKey = "114ff0c3b57a0ec62e15efdedefd2e6f";
$api = new ScopusApi($apiKey);
$apiKey = "your-api-key-here";
$api = (new ScopusApiFactory($apiKey))->createApiClient();

// Scopus Search API
$results = $api
Expand Down Expand Up @@ -56,15 +71,48 @@ foreach ($results->getEntries() as $entry) {

## API Docs

https://kasparsj.github.io/scopus-api-php/
Official API documentation:
[https://grinchenkoedu.github.io/scopus-api-php/](https://grinchenkoedu.github.io/scopus-api-php/)

## Development

Install the development dependencies and run the test suite:

```bash
composer install
vendor/bin/phpunit
```

Coverage is not configured in `phpunit.xml.dist`, because the source filter is
spelled differently in PHPUnit 9 and PHPUnit 10+ and this package supports both.
Request it on the command line instead:

```bash
vendor/bin/phpunit --coverage-text --coverage-filter src # PHPUnit 10 and 11
vendor/bin/phpunit --coverage-text --whitelist src # PHPUnit 8.5 and 9
```

### API documentation

`docs/` is generated output, published at the API Docs link above via GitHub Pages
(`master` branch, `/docs` folder). **You do not need to regenerate it by hand** — the
**Docs** workflow rebuilds it on every change to `src/` or `composer.json` and commits
the result.

Generation is kept on CI on purpose: ApiGen lists implementing classes in filesystem
order without sorting them, so the same source produces different output on macOS and
on Linux. Running it in one place keeps the result reproducible.

## Changelog
- 01/05/2022 - v1.3
* Added Abstract Citations Count API
- 14/11/2021 - v1.2
* Bug fix
- 19/05/2020 - v1.1
* Added Search Author API
* Added Citation Overview API
* Created a support function to retrieve Document of specific Author easly
* Updated classes

See [CHANGELOG.md](CHANGELOG.md) for a list of changes.

## Contributors

Thanks to all the contributors who have helped build and maintain this package:

![Contributors](https://contrib.rocks/image?repo=grinchenkoedu/scopus-api-php)

## License

This project is licensed under the MIT License.
41 changes: 35 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
{
"name": "kasparsj/scopus-search-api",
"name": "grinchenkoedu/scopus-search-api",
"description": "Scopus API for PHP (Unofficial)",
"keywords": [
"scopus",
"elsevier",
"api",
"sdk",
"bibliometrics",
"citations",
"abstracts",
"research"
],
"homepage": "https://github.com/grinchenkoedu/scopus-api-php",
"support": {
"issues": "https://github.com/grinchenkoedu/scopus-api-php/issues",
"source": "https://github.com/grinchenkoedu/scopus-api-php",
"docs": "https://grinchenkoedu.github.io/scopus-api-php/"
},
"minimum-stability": "stable",
"license": "MIT",
"version": "1.3",
"authors": [
{
"name": "Kaspars Jaudzems",
Expand All @@ -12,14 +27,28 @@
{
"name": "Antonino Bonanno",
"email": "nino.bonanno96@gmail.com"
},
{
"name": "Yevhen Matasar",
"email": "matasar.ei@gmail.com"
}
],
"require": {
"guzzlehttp/guzzle": ">=6.3.0"
"php": "^7.4 || ^8.0",
"guzzlehttp/guzzle": "^7.15.2 || ^8.0.1"
},
"autoload": {
"psr-0": {
"Scopus\\": "src/"
"psr-4": {
"Scopus\\": "src/Scopus/"
}
}
},
"autoload-dev": {
"psr-4": {
"Scopus\\Tests\\": "tests/"
}
},
"require-dev": {
"phpunit/phpunit": "^9.5 || ^10.0 || ^11.0"
},
"type": "library"
}
Loading