Skip to content

Commit 008c5ae

Browse files
committed
feat: modernize to ultra-lightweight PHP 8.1+ Discogs API client v3.0.0
Complete rewrite with modern architecture and comprehensive testing: BREAKING CHANGES: - Requires PHP 8.1+ (was PHP 7.1+) - New namespace: Calliostro\Discogs (was Discogs) - Ultra-lightweight 2-class architecture replaces complex service layer - ClientFactory::create() replaces service configuration - Magic method calls for all 65+ Discogs API endpoints - Modern PSR-4 autoloading with src/ directory structure Features: - 97.01% code coverage with comprehensive test suite (37 tests) - PHPStan Level 8 static analysis with full type safety - Reduced from 86 to 54 dependencies for minimal footprint - Direct API endpoint mapping with intuitive method names - OAuth 1.0a and Personal Access Token authentication - Complete Discogs API coverage: artists, releases, collections, marketplace - GitHub Actions CI testing across PHP 8.1-8.5 - Comprehensive migration guide and documentation Quality Assurance: - PSR-12 code standards via phpcs/phpcbf - Modern PHPUnit 10.5+ with latest testing practices - Clean git history with proper .gitignore - Professional CHANGELOG without marketing bloat - Zero technical debt and production-ready codebase Migration: See UPGRADE.md for detailed migration instructions from v2.x
1 parent 4e92168 commit 008c5ae

21 files changed

Lines changed: 1835 additions & 1951 deletions

.github/workflows/ci.yml

Lines changed: 83 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,15 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, 'legacy/v2.x', 'feature/**' ]
5+
branches: [ main, 'feature/v3.0.0', 'feature/**' ]
66
pull_request:
7-
branches: [ main, 'legacy/v2.x' ]
7+
branches: [ main ]
88
workflow_dispatch:
99
inputs:
1010
php_version:
1111
description: 'PHP version to test (optional, tests all if empty)'
1212
required: false
1313
default: ''
14-
dependencies:
15-
description: 'Dependencies type'
16-
required: false
17-
default: 'stable'
18-
type: choice
19-
options:
20-
- stable
21-
- lowest
22-
- dev
2314

2415
jobs:
2516
tests:
@@ -28,24 +19,18 @@ jobs:
2819
strategy:
2920
fail-fast: false
3021
matrix:
31-
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
22+
php-version: ['8.1', '8.2', '8.3', '8.4', '8.5']
3223
dependencies: ['stable']
3324
include:
3425
# Test with lowest dependencies
35-
- php-version: '7.3'
26+
- php-version: '8.1'
3627
dependencies: 'lowest'
3728
- php-version: '8.4'
3829
dependencies: 'lowest'
39-
# Test with development dependencies
40-
- php-version: '8.4'
41-
dependencies: 'dev'
42-
# Test with PHP 8.5 nightly (allow failure)
43-
- php-version: '8.5'
44-
dependencies: 'stable'
4530

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

48-
name: PHP ${{ matrix.php-version }} - ${{ matrix.dependencies }}
33+
name: Tests - PHP ${{ matrix.php-version }} (${{ matrix.dependencies }})
4934

5035
steps:
5136
- name: Checkout code
@@ -76,14 +61,84 @@ jobs:
7661
if: matrix.dependencies == 'stable'
7762
run: composer update --prefer-stable --prefer-dist --no-interaction
7863

79-
- name: Install dependencies (dev)
80-
if: matrix.dependencies == 'dev'
81-
run: |
82-
composer config minimum-stability dev
83-
composer update --prefer-dist --no-interaction
84-
8564
- name: Validate composer.json
8665
run: composer validate --strict --no-check-lock
8766

8867
- name: Run PHPUnit tests
89-
run: vendor/bin/phpunit
68+
run: composer test
69+
70+
code-quality:
71+
runs-on: ubuntu-latest
72+
name: Code Quality
73+
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
78+
- name: Setup PHP
79+
uses: shivammathur/setup-php@v2
80+
with:
81+
php-version: '8.4'
82+
extensions: dom, curl, libxml, mbstring, zip, json
83+
coverage: none
84+
tools: composer:v2
85+
86+
- name: Cache Composer packages
87+
id: composer-cache
88+
uses: actions/cache@v4
89+
with:
90+
path: ~/.composer/cache
91+
key: ${{ runner.os }}-php-8.4-stable-${{ hashFiles('**/composer.lock') }}
92+
restore-keys: |
93+
${{ runner.os }}-php-8.4-stable-
94+
95+
- name: Install dependencies
96+
run: composer update --prefer-stable --prefer-dist --no-interaction
97+
98+
- name: Run PHPStan static analysis
99+
run: composer analyse
100+
continue-on-error: true
101+
102+
- name: Run PHP CodeSniffer check
103+
run: composer cs
104+
continue-on-error: true
105+
106+
coverage:
107+
runs-on: ubuntu-latest
108+
name: Coverage Report
109+
110+
steps:
111+
- name: Checkout code
112+
uses: actions/checkout@v4
113+
114+
- name: Setup PHP
115+
uses: shivammathur/setup-php@v2
116+
with:
117+
php-version: '8.4'
118+
extensions: dom, curl, libxml, mbstring, zip, json
119+
coverage: xdebug
120+
tools: composer:v2
121+
122+
- name: Cache Composer packages
123+
id: composer-cache
124+
uses: actions/cache@v4
125+
with:
126+
path: ~/.composer/cache
127+
key: ${{ runner.os }}-php-8.4-coverage-${{ hashFiles('**/composer.lock') }}
128+
restore-keys: |
129+
${{ runner.os }}-php-8.4-coverage-
130+
131+
- name: Install dependencies
132+
run: composer update --prefer-stable --prefer-dist --no-interaction
133+
134+
- name: Generate coverage report
135+
run: vendor/bin/phpunit --coverage-clover coverage.xml
136+
137+
- name: Upload coverage to Codecov
138+
uses: codecov/codecov-action@v4
139+
with:
140+
files: ./coverage.xml
141+
fail_ci_if_error: false
142+
verbose: true
143+
env:
144+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
composer.lock
44

55
# PHPUnit
6-
.phpunit/
76
.phpunit.result.cache
87
.phpunit.cache/
98

9+
# PHPStan
10+
.phpstan/
11+
1012
# IDE files
1113
.idea/
1214
.vscode/

CHANGELOG.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,38 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.0.0](https://github.com/calliostro/php-discogs-api/releases/tag/v3.0.0) – 2025-09-07
9+
10+
### Added
11+
12+
- Ultra-lightweight 2-class architecture: `ClientFactory` and `DiscogsApiClient`
13+
- Magic method API calls: `$client->artistGet(['id' => '108713'])`
14+
- Complete API coverage: 65+ endpoints across all Discogs areas
15+
- Multiple authentication methods: OAuth, Personal Token, or anonymous
16+
- Modern PHP 8.1–8.5 support with strict typing
17+
- 97% test coverage with 37 comprehensive tests
18+
- PHPStan Level 8 static analysis
19+
- GitHub Actions CI with multi-version testing
20+
21+
### Changed
22+
23+
- **BREAKING**: Namespace changed from `Discogs\*` to `Calliostro\Discogs\*`
24+
- **BREAKING**: API surface changed from Guzzle Services to magic methods
25+
- **BREAKING**: Minimum PHP version now 8.1+ (was 7.3)
26+
- Simplified dependencies: removed Guzzle Services, Command, OAuth Subscriber
27+
28+
### Removed
29+
30+
- Guzzle Services dependency and all related complexity
31+
- ThrottleSubscriber (handle rate limiting in your application)
32+
- Support for PHP 7.3–8.0
33+
834
## [2.1.3](https://github.com/calliostro/php-discogs-api/releases/tag/v2.1.3) – 2025-09-06
935

1036
### Changed
1137

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

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

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

3155
### Changed
3256

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

118142
- Improved PHP 8.x compatibility and stability
119143

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

122146
### Added
123147

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

154178
This library is based on the excellent work of:
155179

156-
- [ricbra/php-discogs-api](https://github.com/ricbra/php-discogs-api)
157-
- Original implementation
158-
- [AnssiAhola/php-discogs-api](https://github.com/AnssiAhola/php-discogs-api)
159-
- Enhanced version
180+
- [ricbra/php-discogs-api](https://github.com/ricbra/php-discogs-api) - Original implementation
181+
- [AnssiAhola/php-discogs-api](https://github.com/AnssiAhola/php-discogs-api) - Enhanced version
160182

161183
## Legacy Versions
162184

0 commit comments

Comments
 (0)