@@ -5,13 +5,164 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8- ## [ Unreleased]
8+ ## [ 4.0.0] ( https://github.com/calliostro/php-discogs-api/releases/tag/v4.0.0 ) – 2025-12-01
9+
10+ ### 🚀 Complete Library Redesign – v4.0 is a Fresh Start
11+
12+ ** v4.0.0** represents a fundamental architectural overhaul. This is not an incremental update – it's a complete rewrite prioritizing developer experience, type safety, and minimal code footprint.
13+
14+ ### Breaking Changes from v3.x
15+
16+ #### 1. Class Renaming for Consistency
17+
18+ - ` DiscogsApiClient ` → ` DiscogsClient `
19+ - ` ClientFactory ` → ` DiscogsClientFactory `
20+
21+ #### 2. Method Naming Revolution
22+
23+ ** All 60 API methods renamed** following consistent ` verb + noun ` patterns:
24+
25+ - ` artistGet() ` → ` getArtist() `
26+ - ` artistReleases() ` → ` listArtistReleases() `
27+ - ` releaseGet() ` → ` getRelease() `
28+ - ` userEdit() ` → ` updateUser() `
29+ - ` collectionFolders() ` → ` listCollectionFolders() `
30+ - ` inventoryGet() ` → ` getUserInventory() `
31+ - ` listingCreate() ` → ` createMarketplaceListing() `
32+ - ` ordersGet() ` → ` getMarketplaceOrders() `
33+
34+ #### 3. Clean Parameter API (No More Arrays)
35+
36+ ** Revolutionary method signatures** eliminate array parameters entirely:
37+
38+ ``` php
39+ // v3.x (OLD)
40+ $artist = $discogs->artistGet(['id' => 5590213]);
41+ $search = $discogs->search(['q' => 'Billie Eilish', 'type' => 'artist', 'per_page' => 50]);
42+ $collection = $discogs->collectionItems(['username' => 'user', 'folder_id' => 0]);
43+
44+ // v4.0 (NEW) - Clean parameters
45+ $artist = $discogs->getArtist(5590213);
46+ $search = $discogs->search(query: 'Billie Eilish', type: 'artist', perPage: 50);
47+ $collection = $discogs->listCollectionItems(username: 'user', folderId: 0);
48+ ```
49+
50+ #### 4. Enhanced Authentication Architecture
51+
52+ ** Complete authentication rewrite** with proper security standards:
53+
54+ - ** Personal Access Token** : Now requires consumer credentials for proper Discogs Auth format
55+ - ** OAuth 1.0a** : RFC 5849 compliant with PLAINTEXT signatures
56+ - ** Method Renaming** : ` createWithToken() ` → ` createWithPersonalAccessToken() `
57+
58+ ``` php
59+ // v3.x (OLD)
60+ $discogs = ClientFactory::createWithToken('token');
61+
62+ // v4.0 (NEW)
63+ $discogs = DiscogsClientFactory::createWithPersonalAccessToken('key', 'secret', 'token');
64+ ```
65+
66+ ### What's New in v4.0
67+
68+ #### Revolutionary Developer Experience
69+
70+ - ** Zero Array Parameters** – Direct method calls: ` getArtist(123) ` vs ` getArtist(['id' => 123]) `
71+ - ** Perfect IDE Autocomplete** – Full IntelliSense support with typed parameters
72+ - ** Type Safety** – Automatic parameter validation and conversion (DateTime, booleans, objects)
73+ - ** Self-Documenting Code** – Method names clearly indicate action and resource
74+
75+ #### Ultra-Lightweight Architecture
76+
77+ - ** ~ 750 Lines Total** – Minimal codebase covering all 60 Discogs API endpoints
78+ - ** 2 Core Classes** – ` DiscogsClient ` and ` DiscogsClientFactory ` handle everything
79+ - ** Zero Bloat** – No unnecessary abstractions or complex inheritance hierarchies
80+ - ** Direct API Mapping** – Each method maps 1:1 to a Discogs endpoint
81+
82+ #### Enterprise-Grade Security
83+
84+ - ** RFC 5849 OAuth 1.0a** – Industry-standard OAuth implementation
85+ - ** Secure Nonce Generation** – Cryptographically secure random values
86+ - ** ReDoS Protection** – Input validation prevents regular expression attacks
87+ - ** Proper Authentication Headers** – Discogs-compliant auth format
88+
89+ #### Comprehensive Type Safety
90+
91+ - ** Strict Parameter Validation** – Only camelCase parameters from PHPDoc accepted
92+ - ** Automatic Type Conversion** – DateTime → ISO 8601, boolean → "1"/"0" for queries
93+ - ** Required Parameter Enforcement** – ` null ` values rejected for required parameters
94+ - ** Object Support** – Custom objects with ` __toString() ` method automatically converted
95+
96+ ### Migration Impact
97+
98+ ** This is a complete breaking change.** Every method call in your codebase will need updating:
99+
100+ 1 . ** Update class names** : ` DiscogsApiClient ` → ` DiscogsClient ` , ` ClientFactory ` → ` DiscogsClientFactory `
101+ 2 . ** Update method names** : Use the complete mapping table in [ UPGRADE.md] ( UPGRADE.md )
102+ 3 . ** Remove all arrays** : Convert array parameters to positional parameters
103+ 4 . ** Update authentication** : Personal tokens now require consumer credentials
104+
105+ ### Design Goals
106+
107+ ** v4.0 prioritizes long-term developer experience:**
108+
109+ - ** Cleaner Code** : Direct method calls without array parameters
110+ - ** Better IDE Support** : Full autocomplete and type checking
111+ - ** Consistent API** : All methods follow the same naming pattern
112+ - ** Type Safety** : Catch errors at development time, not runtime
113+
114+ ### Added Features
115+
116+ - ** Complete OAuth 1.0a Support** with ` OAuthHelper ` class for full authorization flows
117+ - ** Enhanced Error Handling** with clear exception messages for migration issues
118+ - ** Integration Test Suite** with comprehensive authentication level testing
119+ - ** CI/CD Integration** with automatic rate limiting and retry logic
120+ - ** Static Analysis** – PHPStan Level 8 compliance with zero errors
121+ - ** Performance Optimizations** – Config caching and reduced file I/O operations
122+ - ** Consistent Class Naming** – ` DiscogsClient ` and ` DiscogsClientFactory ` for better clarity
123+
124+ ### Migration Resources
125+
126+ - ** Complete Method Mapping** : See [ UPGRADE.md] ( UPGRADE.md ) for all 60 method name changes
127+ - ** Parameter Examples** : Detailed before/after code samples for common operations
128+ - ** Authentication Guide** : Step-by-step migration for all authentication types
129+ - ** Automated Scripts** : Bash/sed commands to help identify and replace common patterns
130+
131+ ---
132+
133+ ## [ 3.1.0] ( https://github.com/calliostro/php-discogs-api/releases/tag/v3.1.0 ) – 2025-09-09
134+
135+ ### Added
136+
137+ - ** OAuth 1.0a Helper Methods** – Complete OAuth flow support with a separate OAuthHelper class
138+ - ` getRequestToken() ` – Get temporary request token for authorization flow
139+ - ` getAuthorizationUrl() ` – Generate user authorization URL
140+ - ` getAccessToken() ` – Exchange request token for permanent access token
141+ - ** Clean Authentication API** – Dedicated methods for different authentication types
142+ - ` createWithPersonalAccessToken() ` – Clean 3-parameter method for Personal Access Tokens
143+ - ` createWithOAuth() ` – Refined 4-parameter method for OAuth 1.0a tokens only
144+ - ** Enhanced OAuth Documentation** – Comprehensive OAuth workflow examples and security best practices
145+ - ** OAuth Unit Tests** – Full test coverage for new OAuth helper methods and authentication methods
146+
147+ ### Changed
148+
149+ - ** BREAKING** : ClientFactory methods now accept array|GuzzleClient parameters (following LastFm pattern)
150+ - ** Authentication API Redesign** – Cleaner separation between Personal Access Token and OAuth 1.0a authentication
151+ - Updated all default User-Agent strings to version ` 3.1.0 `
152+ - Enhanced OAuth client creation with a proper PLAINTEXT signature method
153+ - Documentation restructured for better usability
154+
155+ ### Fixed
156+
157+ - OAuth request token method now uses a proper HTTP method (GET instead of POST)
158+ - OAuth signature generation follows Discogs API requirements exactly
159+ - PHPStan Level 8 compatibility with proper type annotations for OAuth responses
9160
10161## [ 3.0.1] ( https://github.com/calliostro/php-discogs-api/releases/tag/v3.0.1 ) – 2025-09-09
11162
12163### Added
13164
14- - Complete PHPDoc coverage for all 62 Discogs API endpoints
165+ - Complete PHPDoc coverage for all 60 Discogs API endpoints
15166- Missing @method annotations for 22 additional API methods
16167- Full IDE autocomplete support for inventory, collection, and marketplace operations
17168
@@ -33,8 +184,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
33184### Added
34185
35186- Ultra-lightweight 2-class architecture: ` ClientFactory ` and ` DiscogsApiClient `
36- - Magic method API calls: ` $client->artistGet(['id' => '108713 ']) `
37- - Complete API coverage: 65+ endpoints across all Discogs areas
187+ - Magic method API calls: ` $client->artistGet(['id' => '5590213 ']) `
188+ - Complete API coverage: 60 endpoints across all Discogs areas
38189- Multiple authentication methods: OAuth, Personal Token, or anonymous
39190- Modern PHP 8.1–8.5 support with strict typing
40191- 100% test coverage with 43 comprehensive tests
0 commit comments