Skip to content

Migrate adapters to utopia-php/fetch#49

Open
lohanidamodar wants to merge 2 commits intomainfrom
feat/clo-4291-migrate-to-fetch
Open

Migrate adapters to utopia-php/fetch#49
lohanidamodar wants to merge 2 commits intomainfrom
feat/clo-4291-migrate-to-fetch

Conversation

@lohanidamodar
Copy link
Copy Markdown
Contributor

Summary

  • Replace raw PHP curl with utopia-php/fetch (^1.1) in all four adapters: Sentry, AppSignal, LogOwl, Raygun.
  • Adapter public API is unchanged — fetch is purely an internal substitution.
  • Bump composer php constraint to >=8.1 (fetch's minimum). Suggest a major-version tag for downstream.

Why

  • Unifies HTTP handling across the Utopia ecosystem (timeouts, retries, content-type, redirects).
  • Removes the PHP 8.5 curl_close() deprecation as a side effect (no more raw curl_* calls).

Test plan

  • composer lint (Pint)
  • composer check (PHPStan max)
  • composer test (unit + e2e)

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 3, 2026

Greptile Summary

This PR replaces raw curl_* calls with utopia-php/fetch across all four adapters (Sentry, AppSignal, LogOwl, Raygun) and bumps the PHP floor to >=8.1 to match the library's minimum. The migration is mechanically clean: timeouts are correctly converted from seconds to milliseconds (× 1000) as required by Client::setTimeout/setConnectTimeout, array bodies are passed directly (the library auto-encodes to JSON when Content-Type: application/json is set), and each adapter wraps the call in a FetchException catch that returns 500 on network failure — consistent with the prior curl_exec/curl_error fallback behaviour.

Confidence Score: 5/5

This PR is safe to merge — it is a straightforward internal HTTP-client substitution with no public API changes and no logic regressions.

No P0 or P1 findings. Timeout unit conversion, body encoding, exception handling, and method names all match the fetch library's v1.1.2 contract. The previously flagged Raygun doc-comment issue is resolved in this diff.

No files require special attention.

Important Files Changed

Filename Overview
src/Logger/Adapter/Sentry.php Migrated from raw curl to utopia-php/fetch; timeout conversion (seconds → ms with ×1000), FetchException handling, and array body auto-encoding are all correct.
src/Logger/Adapter/AppSignal.php Migrated to utopia-php/fetch with correct timeout handling and exception wrapping; no functional regressions detected.
src/Logger/Adapter/LogOwl.php Migrated to utopia-php/fetch with correct timeout handling and exception wrapping; no functional regressions detected.
src/Logger/Adapter/Raygun.php Migrated to utopia-php/fetch with correct timeout handling and exception wrapping; previously flagged stale doc comment is now corrected.
composer.json Adds utopia-php/fetch ^1.1 dependency and bumps PHP floor to >=8.1 to match the library's requirement.

Reviews (2): Last reviewed commit: "Fix Raygun docblock copy-paste reference" | Re-trigger Greptile

The property comment incorrectly referenced AppSignal's setup path. Updated to reference Raygun's correct API-key location.
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.

2 participants