You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove ApiVersion::LATEST constant and require explicit version selection
Prevent semantic versioning violations where library updates automatically
change API versions, potentially breaking production apps without developer
awareness or control
Breaking change: apiVersion parameter now required in Context::initialize()
Migration: Developers must explicitly specify API version (e.g., '2025-10')
Aligns with Ruby library PR #1411 and broader Shopify library strategy
See BREAKING_CHANGES_FOR_V6.md for complete migration guide
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The `ApiVersion::LATEST` constant has been removed to prevent semantic versioning (semver) breaking changes. Previously, this constant would automatically update every quarter when new API versions were released, causing unintended breaking changes for apps.
6
+
7
+
### Migration Guide
8
+
9
+
**If you were using the constant directly:**
10
+
11
+
```php
12
+
// Before (v5 and earlier)
13
+
$apiVersion = ApiVersion::LATEST;
14
+
15
+
// After (v6+)
16
+
$apiVersion = '2025-07'; // Explicitly specify the version you want to use
17
+
```
18
+
19
+
**In your Context::initialize():**
20
+
21
+
The `apiVersion` parameter is now **required** in `Context::initialize()`. You must explicitly specify which API version you want to use:
22
+
23
+
```php
24
+
// Before (v5 and earlier)
25
+
Context::initialize(
26
+
apiKey: $_ENV['SHOPIFY_API_KEY'],
27
+
apiSecretKey: $_ENV['SHOPIFY_API_SECRET'],
28
+
scopes: $_ENV['SHOPIFY_APP_SCOPES'],
29
+
hostName: $_ENV['SHOPIFY_APP_HOST_NAME'],
30
+
sessionStorage: new FileSessionStorage('/tmp/php_sessions'),
31
+
// apiVersion was optional with default ApiVersion::LATEST
32
+
);
33
+
34
+
// After (v6+)
35
+
Context::initialize(
36
+
apiKey: $_ENV['SHOPIFY_API_KEY'],
37
+
apiSecretKey: $_ENV['SHOPIFY_API_SECRET'],
38
+
scopes: $_ENV['SHOPIFY_APP_SCOPES'],
39
+
hostName: $_ENV['SHOPIFY_APP_HOST_NAME'],
40
+
sessionStorage: new FileSessionStorage('/tmp/php_sessions'),
41
+
apiVersion: '2025-07', // Now required - explicitly specify the version
42
+
);
43
+
```
44
+
45
+
**Finding the right API version:**
46
+
47
+
You can reference the available API versions in the `ApiVersion` class:
48
+
49
+
```php
50
+
use Shopify\ApiVersion;
51
+
52
+
// Available constants (as of this release):
53
+
ApiVersion::UNSTABLE // "unstable"
54
+
ApiVersion::JULY_2025 // "2025-07"
55
+
ApiVersion::APRIL_2025 // "2025-04"
56
+
ApiVersion::JANUARY_2025 // "2025-01"
57
+
ApiVersion::OCTOBER_2024 // "2024-10"
58
+
// ... and older versions
59
+
```
60
+
61
+
Or you can use string literals directly:
62
+
63
+
```php
64
+
Context::initialize(
65
+
// ... other parameters
66
+
apiVersion: '2025-07',
67
+
);
68
+
```
69
+
70
+
**Why this change?**
71
+
72
+
By requiring explicit version specification, apps can:
73
+
- Control when they upgrade to new API versions
74
+
- Test thoroughly before upgrading
75
+
- Avoid unexpected breaking changes from automatic version updates
76
+
- Follow semantic versioning principles more accurately
77
+
78
+
**Recommended approach:**
79
+
80
+
1. Review the [Shopify API release notes](https://shopify.dev/docs/api/release-notes) to understand changes between versions
81
+
2. Choose the API version that best suits your app's needs
82
+
3. Explicitly specify that version in your `Context::initialize()` call
83
+
4. Test your app thoroughly with the chosen version
84
+
5. Upgrade to newer versions on your own schedule after proper testing
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
8
8
## Unreleased
9
+
- ⚠️ [Breaking] Remove `ApiVersion::LATEST` constant to prevent semver violations. The `apiVersion` parameter is now required in `Context::initialize()`. Developers must explicitly specify API versions. See the [migration guide](BREAKING_CHANGES_FOR_V6.md#removal-of-apiversionlatest-constant) for details.
|`hostName`|`string`| Yes | - | App host name e.g. `my-app.my-domain.ca`. You may optionally include `https://` or `http://` to determine which scheme to use |
21
21
|`sessionStorage`|`SessionStorage`| Yes | - | Session storage strategy. Read our [notes on session handling](issues.md#notes-on-session-handling) for more information |
22
-
|`apiVersion`|`string`|No|`ApiVersion::LATEST`| App API version, defaults to `ApiVersion::LATEST`|
22
+
|`apiVersion`|`string`|Yes| - | App API version. You must explicitly specify which API version to use (e.g., `'2025-07'`, `'2024-10'`, etc.)|
23
23
|`isEmbeddedApp`|`bool`| No |`true`| Whether the app is an embedded app |
24
24
|`isPrivateApp`|`bool`| No |`false`| Whether the app is a private app |
25
25
|`userAgentPrefix`|`string`| No | - | Prefix for user agent header sent with a request |
0 commit comments