Skip to content

feat: PHP SDK update for version 25.0.0#77

Merged
ArnabChatterjee20k merged 5 commits into
mainfrom
dev
Jun 1, 2026
Merged

feat: PHP SDK update for version 25.0.0#77
ArnabChatterjee20k merged 5 commits into
mainfrom
dev

Conversation

@premtsd-code
Copy link
Copy Markdown
Contributor

@premtsd-code premtsd-code commented May 27, 2026

This PR contains updates to the PHP SDK for version 25.0.0.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 27, 2026

Greptile Summary

This PR updates the Appwrite PHP SDK from v24.2.0 to v25.0.0, adding a new Organization service (with key and project management endpoints), new enum classes (BrowserTheme, HealthQueueName, OrganizationKeyScopes), new policy models (PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail), and expanded Site/FunctionModel models with providerBranches and providerPaths fields.

  • New Organization service: full CRUD for organization API keys and projects, using new OrganizationKeyScopes and Region enums; createKey and updateKey still carry unguarded null assignments for the optional expire field (flagged in prior review rounds).
  • Functions::update() and Sites::update(): the newly introduced providerBranches and providerPaths optional params are unconditionally written to $apiParams without null guards — the symmetric create() methods on both services handle them correctly with is_null guards (also flagged in prior review rounds).
  • Enum renames: Theme → BrowserTheme, Name → HealthQueueName — these are non-breaking within the SDK but are source-breaking for any downstream caller who referenced the old enum types directly.

Confidence Score: 4/5

The PR is functionally correct for the happy path, but several optional parameters in the new Organization service and both update methods (Functions and Sites) are assigned to the request body unconditionally, meaning callers who omit them will send explicit nulls to the server.

The new Organization service and the updated Functions/Sites services consistently fail to null-guard optional parameters before writing them to $apiParams. In createKey and updateKey the optional expire field is always sent, and in Functions::update() and Sites::update() the new providerBranches and providerPaths fields are written unconditionally while the corresponding create() methods handle them correctly. These issues were flagged in prior review rounds and remain unaddressed.

src/Appwrite/Services/Organization.php (createKey/updateKey), src/Appwrite/Services/Functions.php (update), and src/Appwrite/Services/Sites.php (update)

Important Files Changed

Filename Overview
src/Appwrite/Services/Organization.php New service for organization key/project management; createKey and updateKey unconditionally write null to $apiParams['expire'] when the optional param is omitted (flagged in previous review rounds, still unaddressed).
src/Appwrite/Services/Functions.php Adds providerBranches/providerPaths params; update() still assigns those two params unconditionally without null-guards, while create() handles them correctly.
src/Appwrite/Services/Sites.php Adds providerBranches/providerPaths params; create() correctly null-guards them but update() unconditionally assigns both, sending explicit null to the API when callers omit them.
src/Appwrite/Services/Project.php Adds three new PolicyDeny* discriminator branches to getPolicy(); the $id matching and model hydration look correct.
src/Appwrite/Models/FunctionModel.php Adds required providerBranches and providerPaths array fields with proper validation and serialization; no issues.
src/Appwrite/Models/Site.php Adds required providerBranches and providerPaths array fields with proper validation and serialization; no issues.
src/Appwrite/Models/Presence.php Migrates metadata from open-ended additional-properties bag to a typed nullable ?array field; intentional for v25.
src/Appwrite/Enums/HealthQueueName.php New enum replacing the old Name enum for health queue names; well-formed.
src/Appwrite/Enums/OrganizationKeyScopes.php New enum for organization API key scopes; well-formed with proper from() mapping.

Reviews (5): Last reviewed commit: "chore: merge main and resolve version co..." | Re-trigger Greptile

Comment on lines 409 to 415
if (!is_null($providerRootDirectory)) {
$apiParams['providerRootDirectory'] = $providerRootDirectory;
}
$apiParams['providerBranches'] = $providerBranches;
$apiParams['providerPaths'] = $providerPaths;

if (!is_null($buildSpecification)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 providerBranches and providerPaths are optional parameters in Sites::update() but are unconditionally added to $apiParams, sending null to the API for any call that omits them. The same pattern (without null checks) also appeared in Functions::update() for the same fields.

Suggested change
if (!is_null($providerRootDirectory)) {
$apiParams['providerRootDirectory'] = $providerRootDirectory;
}
$apiParams['providerBranches'] = $providerBranches;
$apiParams['providerPaths'] = $providerPaths;
if (!is_null($buildSpecification)) {
if (!is_null($providerRootDirectory)) {
$apiParams['providerRootDirectory'] = $providerRootDirectory;
}
if (!is_null($providerBranches)) {
$apiParams['providerBranches'] = $providerBranches;
}
if (!is_null($providerPaths)) {
$apiParams['providerPaths'] = $providerPaths;
}
if (!is_null($buildSpecification)) {

Comment on lines +446 to +448
$uploadId = '';
$uploadId = $fileId ?? '';
$totalChunks = (int) ceil($size / Client::CHUNK_SIZE);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The first $uploadId = ''; assignment is immediately overwritten by $uploadId = $fileId ?? ''; on the next line, making the first line dead code. The indentation inconsistency also suggests a merge/generation artefact.

Suggested change
$uploadId = '';
$uploadId = $fileId ?? '';
$totalChunks = (int) ceil($size / Client::CHUNK_SIZE);
$uploadId = $fileId ?? '';
$totalChunks = (int) ceil($size / Client::CHUNK_SIZE);

Comment thread src/Appwrite/Services/Functions.php
@ArnabChatterjee20k ArnabChatterjee20k changed the title feat: PHP SDK update for version 24.0.0 feat: PHP SDK update for version 25.0.0 Jun 1, 2026
Comment on lines +81 to +90
$apiParams['keyId'] = $keyId;
$apiParams['name'] = $name;
$apiParams['scopes'] = $scopes;
$apiParams['expire'] = $expire;

$apiHeaders = [];
$apiHeaders['content-type'] = 'application/json';

$response = $this->client->call(
Client::METHOD_POST,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 expire is an optional parameter (?string $expire = null) in createKey but is always written to $apiParams without a null-guard. Every createKey call that omits expire will send null to the API, bypassing any server-side default and potentially causing a validation error.

Suggested change
$apiParams['keyId'] = $keyId;
$apiParams['name'] = $name;
$apiParams['scopes'] = $scopes;
$apiParams['expire'] = $expire;
$apiHeaders = [];
$apiHeaders['content-type'] = 'application/json';
$response = $this->client->call(
Client::METHOD_POST,
$apiParams['keyId'] = $keyId;
$apiParams['name'] = $name;
$apiParams['scopes'] = $scopes;
if (!is_null($expire)) {
$apiParams['expire'] = $expire;
}
$apiHeaders = [];
$apiHeaders['content-type'] = 'application/json';
$response = $this->client->call(
Client::METHOD_POST,

Comment on lines +160 to +169
$apiParams['keyId'] = $keyId;
$apiParams['name'] = $name;
$apiParams['scopes'] = $scopes;
$apiParams['expire'] = $expire;

$apiHeaders = [];
$apiHeaders['content-type'] = 'application/json';

$response = $this->client->call(
Client::METHOD_PUT,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 expire is optional but assigned to $apiParams unconditionally in updateKey as well, sending null to the API for every call that omits it.

Suggested change
$apiParams['keyId'] = $keyId;
$apiParams['name'] = $name;
$apiParams['scopes'] = $scopes;
$apiParams['expire'] = $expire;
$apiHeaders = [];
$apiHeaders['content-type'] = 'application/json';
$response = $this->client->call(
Client::METHOD_PUT,
$apiParams['keyId'] = $keyId;
$apiParams['name'] = $name;
$apiParams['scopes'] = $scopes;
if (!is_null($expire)) {
$apiParams['expire'] = $expire;
}
$apiHeaders = [];
$apiHeaders['content-type'] = 'application/json';
$response = $this->client->call(
Client::METHOD_PUT,

@ArnabChatterjee20k ArnabChatterjee20k merged commit a3091da into main Jun 1, 2026
1 check passed
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.

3 participants