Move underlying library to shopify/shopify-app-php - #358
Draft
ryanmitchell wants to merge 3 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
shopify/shopify-apiis abandoned — "no new features or security fixes are planned" — and Composer now suggestsshopify/shopify-app-php(official, actively maintained, v1.x, PHP 8.2+) in its place.The addon only ever used two things from the old library: the
Graphqlclient and theContextversion/config holder (no REST resources, no OAuth session handling — webhook HMAC is already hand-rolled). This PR swaps the dependency and keeps the blast radius small with a thin adapter.Changes
New adapter —
src/Clients/Graphql.php— wrapsShopifyApp::adminGraphQLRequest()behind the existingquery(['query' => …, 'variables' => …])call shape. Staticshop()helper reduces the configured*.myshopify.comURL to the bare shop handle the new library expects.HttpResponse.php—status/bodyconstructor +getDecodedBody(), matching whatShopify\Clients\HttpResponsereturned (decodes the raw response body, sodata/errors/extensionskeys are all preserved).ServiceProviderContext::initialize()andFileSessionStorage— the new library has no global state.ShopifyAppsingleton;client_credentialstoken exchange now goes throughexchangeUsingClientCredentials()instead of a hand-rolledHttp::asForm()->post().Support/StoreConfigmakeGraphqlClient()passesapiVersionas a constructor argument (was aContext::$API_VERSIONmutation).admin_token/ OAuth bind branches collapse into oneclient_credentialsexchange uses a per-storeShopifyAppinstance.Consumers & tests
useswap fromShopify\Clients\StatamicRadPack\Shopify\Clients\…`. No logic changes.Traits/ThrottlesShopifyRequestsunchanged —getDecodedBody()still exposesextensions.cost.throttleStatus.Dead config removed
api_private_app,session_storage_path,auth_key,auth_password— ne.Http/Controllers/CP/DashboardController—canRunImportwas gated onauth_key && auth_password(both had non-empty env defaults, so it was effectively always true). Nowgated on
url && (admin_token || client_id), matching `ServiceProvider::setSHOPIFY_SESSION_STORAGE_PATHnote from the setup docs.Breaking changes
This is a major release (7.x → 8.x). Upgrade notes added to
docs/…/3.upgrading.md:\Shopify\Clients\Graphql::query()directly must switch to the wrapper:\StatamicRadPack\Shopify\Clients\Graphql::query().SHOPIFY_AUTH_KEY,SHOPIFY_AUTH_PASSWORD,SHOPIFY_SESSION_STORAGE_PATHconfig values are gone. They were only relevant to the removed REST/basic-auth path.Behaviour notes
shopify/shopify-app-phphardcodeshttps://{shop}.myshopify.com/admin/…for both GraphQL and token exchange. Non-.myshopify.comAdmin API hosts are no longer supported (theAdmin API is only served from
*.myshopify.comanyway).Graphql::query()passesmaxRetries: 0to preserve the old no-retry behaviour; the library's built-in 429/5xx backoff can be enabled later if wanted.client_credentialstoken now carries a realexpires; the existing 1400s TTL is unchanged for now.Testing
vendor/bin/phpunit— 128 passing, 297 assertions.vendor/bin/pint— clean on all touched code (pre-existing style debt inconfig/shopify.php,Tags/Shopify.php,Jobs/ImportSingleProductJob.phpleft untouched to keep the diff focused).