Skip to content

Commit cf74e85

Browse files
authored
Release v3.0.0: PHP 8.1+ rewrite
- Require PHP 8.1+, drop 7.4/8.0 support - Simplify architecture to 2 core classes - Add magic method API for all endpoints - Achieve 100% test coverage (43 tests) - Implement PHPStan Level 8 compliance - Apply PSR-12 coding standards - Add GitHub Actions CI for PHP 8.1-8.5 BREAKING CHANGE: Complete API redesign
1 parent 4e92168 commit cf74e85

24 files changed

Lines changed: 2039 additions & 2005 deletions

.github/workflows/ci.yml

Lines changed: 157 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,88 +2,170 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, 'legacy/v2.x', 'feature/**' ]
5+
branches:
6+
- 'main'
7+
- 'legacy/*' # Legacy branches: legacy/v2.x
8+
- 'feature/*' # Feature branches: feature/new-feature
9+
- 'hotfix/*' # Hotfix branches: hotfix/urgent-fix
10+
- 'release/*' # Release branches: release/v3.0.0
611
pull_request:
7-
branches: [ main, 'legacy/v2.x' ]
8-
workflow_dispatch:
9-
inputs:
10-
php_version:
11-
description: 'PHP version to test (optional, tests all if empty)'
12-
required: false
13-
default: ''
14-
dependencies:
15-
description: 'Dependencies type'
16-
required: false
17-
default: 'stable'
18-
type: choice
19-
options:
20-
- stable
21-
- lowest
22-
- dev
12+
branches:
13+
- 'main'
14+
- 'legacy/*' # PRs to legacy branches
15+
workflow_dispatch: # Allows manual triggering via GitHub UI
2316

2417
jobs:
25-
tests:
18+
test:
2619
runs-on: ubuntu-latest
27-
20+
2821
strategy:
2922
fail-fast: false
3023
matrix:
31-
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
32-
dependencies: ['stable']
3324
include:
34-
# Test with lowest dependencies
35-
- php-version: '7.3'
36-
dependencies: 'lowest'
37-
- php-version: '8.4'
38-
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'
45-
46-
continue-on-error: ${{ matrix.dependencies == 'dev' || matrix.php-version == '8.5' }}
47-
48-
name: PHP ${{ matrix.php-version }} - ${{ matrix.dependencies }}
25+
# Core PHP version testing
26+
- php: '8.1'
27+
allowed-to-fail: false
28+
- php: '8.2'
29+
allowed-to-fail: false
30+
- php: '8.3'
31+
allowed-to-fail: false
32+
- php: '8.4'
33+
allowed-to-fail: false
34+
35+
# Future-ready: PHP 8.5 (alpha/dev) - when available
36+
- php: '8.5'
37+
stability: 'dev'
38+
allowed-to-fail: true
39+
40+
# Development stability tests
41+
- php: '8.4'
42+
stability: 'dev'
43+
allowed-to-fail: true
44+
- php: '8.5'
45+
stability: 'dev'
46+
allowed-to-fail: true
47+
48+
name: "PHP ${{ matrix.php }}${{ matrix.stability && format(' | {0}', matrix.stability) || '' }}"
49+
50+
continue-on-error: ${{ matrix.allowed-to-fail }}
51+
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Setup PHP
57+
uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: ${{ matrix.php }}
60+
extensions: json, mbstring, tokenizer
61+
coverage: xdebug
62+
tools: composer:v2
63+
64+
- name: Get composer cache directory
65+
id: composer-cache
66+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
67+
68+
- name: Cache composer dependencies
69+
uses: actions/cache@v4
70+
with:
71+
path: ${{ steps.composer-cache.outputs.dir }}
72+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
73+
restore-keys: ${{ runner.os }}-composer-
74+
75+
- name: Configure stability
76+
if: matrix.stability
77+
run: |
78+
composer config minimum-stability ${{ matrix.stability }}
79+
composer config prefer-stable true
80+
81+
- name: Remove composer.lock
82+
run: rm -f composer.lock
83+
84+
- name: Install dependencies
85+
run: composer update --prefer-dist --no-interaction --no-progress
86+
87+
- name: Validate composer.json and composer.lock
88+
run: composer validate --strict
89+
90+
- name: Run code style check
91+
run: composer cs
92+
93+
- name: Run static analysis
94+
run: composer analyse
95+
96+
- name: Run tests
97+
run: composer test
98+
99+
code-quality:
100+
runs-on: ubuntu-latest
101+
name: Code Quality Checks
49102

50103
steps:
51-
- name: Checkout code
52-
uses: actions/checkout@v4
53-
54-
- name: Setup PHP
55-
uses: shivammathur/setup-php@v2
56-
with:
57-
php-version: ${{ matrix.php-version }}
58-
extensions: dom, curl, libxml, mbstring, zip, json
59-
coverage: none
60-
tools: composer:v2
61-
62-
- name: Cache Composer packages
63-
id: composer-cache
64-
uses: actions/cache@v4
65-
with:
66-
path: ~/.composer/cache
67-
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
68-
restore-keys: |
69-
${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-
70-
71-
- name: Install dependencies (lowest)
72-
if: matrix.dependencies == 'lowest'
73-
run: composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction
74-
75-
- name: Install dependencies (stable)
76-
if: matrix.dependencies == 'stable'
77-
run: composer update --prefer-stable --prefer-dist --no-interaction
78-
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-
85-
- name: Validate composer.json
86-
run: composer validate --strict --no-check-lock
87-
88-
- name: Run PHPUnit tests
89-
run: vendor/bin/phpunit
104+
- name: Checkout code
105+
uses: actions/checkout@v4
106+
107+
- name: Setup PHP
108+
uses: shivammathur/setup-php@v2
109+
with:
110+
php-version: '8.4'
111+
extensions: json, mbstring, tokenizer
112+
coverage: none
113+
tools: composer:v2
114+
115+
- name: Get composer cache directory
116+
id: composer-cache
117+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
118+
119+
- name: Cache composer dependencies
120+
uses: actions/cache@v4
121+
with:
122+
path: ${{ steps.composer-cache.outputs.dir }}
123+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
124+
restore-keys: ${{ runner.os }}-composer-
125+
126+
- name: Install dependencies
127+
run: composer install --prefer-dist --no-interaction --no-progress
128+
129+
- name: Validate composer.json and composer.lock
130+
run: composer validate --strict
131+
132+
coverage:
133+
runs-on: ubuntu-latest
134+
name: Code Coverage
135+
136+
steps:
137+
- name: Checkout code
138+
uses: actions/checkout@v4
139+
140+
- name: Setup PHP
141+
uses: shivammathur/setup-php@v2
142+
with:
143+
php-version: '8.4'
144+
extensions: json, mbstring, tokenizer
145+
coverage: xdebug
146+
tools: composer:v2
147+
148+
- name: Get composer cache directory
149+
id: composer-cache
150+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
151+
152+
- name: Cache composer dependencies
153+
uses: actions/cache@v4
154+
with:
155+
path: ${{ steps.composer-cache.outputs.dir }}
156+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
157+
restore-keys: ${{ runner.os }}-composer-
158+
159+
- name: Install dependencies
160+
run: composer install --prefer-dist --no-interaction --no-progress
161+
162+
- name: Run tests with coverage
163+
run: vendor/bin/phpunit --coverage-clover coverage.xml
164+
165+
- name: Upload coverage to Codecov
166+
uses: codecov/codecov-action@v4
167+
with:
168+
file: ./coverage.xml
169+
flags: unittests
170+
name: codecov-umbrella
171+
fail_ci_if_error: false

.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
composer.lock
44

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

10-
# IDE files
11-
.idea/
12-
.vscode/
9+
# PHPStan
10+
.phpstan/
11+
12+
# PHP CS Fixer
13+
.php-cs-fixer.cache
1314

1415
# Coverage reports
1516
coverage/

.markdownlint.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
"MD024": {
33
"siblings_only": true
44
},
5-
"MD032": false,
65
"MD013": false
76
}

.php-cs-fixer.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__.'/src')
5+
->in(__DIR__.'/tests')
6+
->exclude('vendor');
7+
8+
$config = new PhpCsFixer\Config();
9+
$config->setFinder($finder)
10+
->setRules([
11+
'@PSR12' => true,
12+
'@PSR12:risky' => true,
13+
])
14+
->setRiskyAllowed(true)
15+
->setUnsupportedPhpVersionAllowed(true);
16+
17+
return $config;

CHANGELOG.md

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,46 @@ 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-08
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+
- 100% test coverage with 43 comprehensive tests
18+
- PHPStan Level 8 static analysis
19+
- GitHub Actions CI with multi-version testing and enhanced branch support
20+
- Codecov integration for code coverage reporting
21+
22+
### Changed
23+
24+
- **BREAKING**: Namespace changed from `Discogs\*` to `Calliostro\Discogs\*`
25+
- **BREAKING**: API surface changed from Guzzle Services to magic methods
26+
- **BREAKING**: Minimum PHP version now 8.1+ (was 7.3)
27+
- Simplified dependencies: removed Guzzle Services, Command, OAuth Subscriber
28+
- Replace `squizlabs/php_codesniffer` with `friendsofphp/php-cs-fixer` for code style checking
29+
- Update code style standard from PSR-12 via PHPCS to PSR-12 via PHP-CS-Fixer
30+
- Add `.php-cs-fixer.php` configuration file with PSR-12 rules
31+
- Update composer scripts: `cs` and `cs-fix` now use php-cs-fixer instead of phpcs/phpcbf
32+
- Update README badges for better consistency and proper branch links
33+
- Enhanced CI workflow with comprehensive PHP version matrix (8.1–8.5)
34+
- Add codecov.yml configuration for coverage reporting
35+
36+
### Removed
37+
38+
- Guzzle Services dependency and all related complexity
39+
- ThrottleSubscriber (handle rate limiting in your application)
40+
- Support for PHP 7.3–8.0
41+
842
## [2.1.3](https://github.com/calliostro/php-discogs-api/releases/tag/v2.1.3) – 2025-09-06
943

1044
### Changed
1145

1246
- 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
47+
- Updated CI workflow and badges to use the main branch
1548
- Prepared for legacy branch support in v2.x series
1649

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

2659
- GitHub Actions CI – Migrated from Travis CI for improved build reliability and faster feedback
2760
- 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
61+
- Enhanced project metadata – Improved description, keywords, and author information in composer.json
3062

3163
### Changed
3264

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

118150
- Improved PHP 8.x compatibility and stability
119151

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

122154
### Added
123155

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

154186
This library is based on the excellent work of:
155187

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
188+
- [ricbra/php-discogs-api](https://github.com/ricbra/php-discogs-api) - Original implementation
189+
- [AnssiAhola/php-discogs-api](https://github.com/AnssiAhola/php-discogs-api) - Enhanced version
160190

161191
## Legacy Versions
162192

0 commit comments

Comments
 (0)