Skip to content

feat: modernize package with Guzzle HTTP client, exceptions and Laravel auto-discovery#3

Open
Elivandro wants to merge 13 commits into
RetroAchievements:mainfrom
Elivandro:main
Open

feat: modernize package with Guzzle HTTP client, exceptions and Laravel auto-discovery#3
Elivandro wants to merge 13 commits into
RetroAchievements:mainfrom
Elivandro:main

Conversation

@Elivandro

Copy link
Copy Markdown

Summary

This PR modernizes the RetroAchievements PHP API client with better standards and Laravel integration.

Changes

Core

  • Replace native PHP HTTP calls with Guzzle HTTP client
  • Return object (stdClass) instead of array for all API responses, allowing dot notation access ($profile->User)
  • Add RetroAchievementsTrait to handle all HTTP logic separately from the service

Error Handling

  • Add custom exception hierarchy (RetroAchievementsException, ApiException, InvalidApiKeyException, InvalidDateException)
  • Prevent API key exposure in error messages
  • Handle 401, 403, 4xx and 5xx responses with meaningful messages

Laravel Integration

  • Add RetroAchievementsProvider with auto-discovery support
  • Add RetroAchievements Facade
  • Add publishable config file

Quality

  • Add PHPStan level 8 static analysis
  • Add Laravel Pint for code style (PSR-12)
  • Add PHPUnit tests with Guzzle MockHandler (no real HTTP calls)

Documentation

  • Update README with installation, usage and API reference in English
  • Add public/index.example.php with standalone and Laravel usage examples

Breaking Changes

  • API responses are now object instead of array — access with -> instead of []
  • Constructor no longer accepts parameters — use setApiKey() instead

Testing

composer check

Related

Closes #

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant