Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
232 changes: 157 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,170 @@ name: CI

on:
push:
branches: [ main, 'legacy/v2.x', 'feature/**' ]
branches:
- 'main'
- 'legacy/*' # Legacy branches: legacy/v2.x
- 'feature/*' # Feature branches: feature/new-feature
- 'hotfix/*' # Hotfix branches: hotfix/urgent-fix
- 'release/*' # Release branches: release/v3.0.0
pull_request:
branches: [ main, 'legacy/v2.x' ]
workflow_dispatch:
inputs:
php_version:
description: 'PHP version to test (optional, tests all if empty)'
required: false
default: ''
dependencies:
description: 'Dependencies type'
required: false
default: 'stable'
type: choice
options:
- stable
- lowest
- dev
branches:
- 'main'
- 'legacy/*' # PRs to legacy branches
workflow_dispatch: # Allows manual triggering via GitHub UI

jobs:
tests:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
dependencies: ['stable']
include:
# Test with lowest dependencies
- php-version: '7.3'
dependencies: 'lowest'
- php-version: '8.4'
dependencies: 'lowest'
# Test with development dependencies
- php-version: '8.4'
dependencies: 'dev'
# Test with PHP 8.5 nightly (allow failure)
- php-version: '8.5'
dependencies: 'stable'

continue-on-error: ${{ matrix.dependencies == 'dev' || matrix.php-version == '8.5' }}

name: PHP ${{ matrix.php-version }} - ${{ matrix.dependencies }}
# Core PHP version testing
- php: '8.1'
allowed-to-fail: false
- php: '8.2'
allowed-to-fail: false
- php: '8.3'
allowed-to-fail: false
- php: '8.4'
allowed-to-fail: false

# Future-ready: PHP 8.5 (alpha/dev) - when available
- php: '8.5'
stability: 'dev'
allowed-to-fail: true

# Development stability tests
- php: '8.4'
stability: 'dev'
allowed-to-fail: true
- php: '8.5'
stability: 'dev'
allowed-to-fail: true

name: "PHP ${{ matrix.php }}${{ matrix.stability && format(' | {0}', matrix.stability) || '' }}"

continue-on-error: ${{ matrix.allowed-to-fail }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, mbstring, tokenizer
coverage: xdebug
tools: composer:v2

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Configure stability
if: matrix.stability
run: |
composer config minimum-stability ${{ matrix.stability }}
composer config prefer-stable true

- name: Remove composer.lock
run: rm -f composer.lock

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

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

- name: Run code style check
run: composer cs

- name: Run static analysis
run: composer analyse

- name: Run tests
run: composer test

code-quality:
runs-on: ubuntu-latest
name: Code Quality Checks

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: dom, curl, libxml, mbstring, zip, json
coverage: none
tools: composer:v2

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-

- name: Install dependencies (lowest)
if: matrix.dependencies == 'lowest'
run: composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction

- name: Install dependencies (stable)
if: matrix.dependencies == 'stable'
run: composer update --prefer-stable --prefer-dist --no-interaction

- name: Install dependencies (dev)
if: matrix.dependencies == 'dev'
run: |
composer config minimum-stability dev
composer update --prefer-dist --no-interaction

- name: Validate composer.json
run: composer validate --strict --no-check-lock

- name: Run PHPUnit tests
run: vendor/bin/phpunit
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: json, mbstring, tokenizer
coverage: none
tools: composer:v2

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress

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

coverage:
runs-on: ubuntu-latest
name: Code Coverage

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: json, mbstring, tokenizer
coverage: xdebug
tools: composer:v2

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Run tests with coverage
run: vendor/bin/phpunit --coverage-clover coverage.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
composer.lock

# PHPUnit
.phpunit/
.phpunit.result.cache
.phpunit.cache/

# IDE files
.idea/
.vscode/
# PHPStan
.phpstan/

# PHP CS Fixer
.php-cs-fixer.cache

# Coverage reports
coverage/
Expand Down
1 change: 0 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"MD024": {
"siblings_only": true
},
"MD032": false,
"MD013": false
}
17 changes: 17 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->exclude('vendor');

$config = new PhpCsFixer\Config();
$config->setFinder($finder)
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
])
->setRiskyAllowed(true)
->setUnsupportedPhpVersionAllowed(true);

return $config;
48 changes: 39 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,46 @@ 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.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.0](https://github.com/calliostro/php-discogs-api/releases/tag/v3.0.0) – 2025-09-08

### Added

- Ultra-lightweight 2-class architecture: `ClientFactory` and `DiscogsApiClient`
- Magic method API calls: `$client->artistGet(['id' => '108713'])`
- Complete API coverage: 65+ endpoints across all Discogs areas
- Multiple authentication methods: OAuth, Personal Token, or anonymous
- Modern PHP 8.1–8.5 support with strict typing
- 100% test coverage with 43 comprehensive tests
- PHPStan Level 8 static analysis
- GitHub Actions CI with multi-version testing and enhanced branch support
- Codecov integration for code coverage reporting

### Changed

- **BREAKING**: Namespace changed from `Discogs\*` to `Calliostro\Discogs\*`
- **BREAKING**: API surface changed from Guzzle Services to magic methods
- **BREAKING**: Minimum PHP version now 8.1+ (was 7.3)
- Simplified dependencies: removed Guzzle Services, Command, OAuth Subscriber
- Replace `squizlabs/php_codesniffer` with `friendsofphp/php-cs-fixer` for code style checking
- Update code style standard from PSR-12 via PHPCS to PSR-12 via PHP-CS-Fixer
- Add `.php-cs-fixer.php` configuration file with PSR-12 rules
- Update composer scripts: `cs` and `cs-fix` now use php-cs-fixer instead of phpcs/phpcbf
- Update README badges for better consistency and proper branch links
- Enhanced CI workflow with comprehensive PHP version matrix (8.1–8.5)
- Add codecov.yml configuration for coverage reporting

### Removed

- Guzzle Services dependency and all related complexity
- ThrottleSubscriber (handle rate limiting in your application)
- Support for PHP 7.3–8.0

## [2.1.3](https://github.com/calliostro/php-discogs-api/releases/tag/v2.1.3) – 2025-09-06

### Changed

- Repository restructuring: Renamed master branch to main
- Updated CI workflow to use the main branch instead of master
- Updated CI badge in README.md to reference the main branch
- Updated CI workflow and badges to use the main branch
- Prepared for legacy branch support in v2.x series

### Infrastructure
Expand All @@ -25,8 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- GitHub Actions CI – Migrated from Travis CI for improved build reliability and faster feedback
- PHP 8.5 nightly support – Early compatibility testing with the upcoming PHP version
- Enhanced project metadata – Improved description, keywords, and author
information in composer.json
- Enhanced project metadata – Improved description, keywords, and author information in composer.json

### Changed

Expand Down Expand Up @@ -117,7 +149,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Improved PHP 8.x compatibility and stability

## [2.0.1](https://github.com/calliostro/php-discogs-api/releases/tag/v2.0.1) – 2021-04-17
## [2.0.1](https://github.com/calliostro/php-discogs-api/releases/tag/v2.1.1) – 2021-04-17

### Added

Expand Down Expand Up @@ -153,10 +185,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

This library is based on the excellent work of:

- [ricbra/php-discogs-api](https://github.com/ricbra/php-discogs-api)
- Original implementation
- [AnssiAhola/php-discogs-api](https://github.com/AnssiAhola/php-discogs-api)
- Enhanced version
- [ricbra/php-discogs-api](https://github.com/ricbra/php-discogs-api) - Original implementation
- [AnssiAhola/php-discogs-api](https://github.com/AnssiAhola/php-discogs-api) - Enhanced version

## Legacy Versions

Expand Down
Loading