Skip to content

Commit 8f7bad9

Browse files
authored
Merge pull request #52 from appwrite/dev
feat: PHP SDK update for version 18.0.0
2 parents e0ea4ae + 200101a commit 8f7bad9

39 files changed

+3811
-1583
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## 18.0.0
4+
5+
* Fix duplicate methods issue (e.g., `updateMFA` and `updateMfa`) causing build and runtime errors
6+
* Add support for `getScreenshot` method to `Avatars` service
7+
* Add `Output`, `Theme` and `Timezone` enums
8+
39
## 17.5.0
410

511
* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"url": "https://appwrite.io/support",
88
"email": "[email protected]"
99
},
10+
"scripts": {
11+
"test": "vendor/bin/phpunit"
12+
},
1013
"autoload": {
1114
"psr-4": {
1215
"Appwrite\\": "src/Appwrite"
@@ -19,7 +22,7 @@
1922
},
2023
"require-dev": {
2124
"phpunit/phpunit": "^10",
22-
"mockery/mockery": "^1.6.6"
25+
"mockery/mockery": "^1.6.12"
2326
},
2427
"minimum-stability": "dev"
2528
}

docs/avatars.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,39 @@ GET https://cloud.appwrite.io/v1/avatars/qr
128128
| margin | integer | Margin from edge. Pass an integer between 0 to 10. Defaults to 1. | 1 |
129129
| download | boolean | Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. | |
130130

131+
132+
```http request
133+
GET https://cloud.appwrite.io/v1/avatars/screenshots
134+
```
135+
136+
** Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.
137+
138+
You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll.
139+
140+
When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. **
141+
142+
### Parameters
143+
144+
| Field Name | Type | Description | Default |
145+
| --- | --- | --- | --- |
146+
| url | string | **Required** Website URL which you want to capture. | |
147+
| headers | object | HTTP headers to send with the browser request. Defaults to empty. | {} |
148+
| viewportWidth | integer | Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. | 1280 |
149+
| viewportHeight | integer | Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. | 720 |
150+
| scale | number | Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. | 1 |
151+
| theme | string | Browser theme. Pass "light" or "dark". Defaults to "light". | light |
152+
| userAgent | string | Custom user agent string. Defaults to browser default. | |
153+
| fullpage | boolean | Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. | |
154+
| locale | string | Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. | |
155+
| timezone | string | IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. | |
156+
| latitude | number | Geolocation latitude. Pass a number between -90 to 90. Defaults to 0. | 0 |
157+
| longitude | number | Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. | 0 |
158+
| accuracy | number | Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. | 0 |
159+
| touch | boolean | Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. | |
160+
| permissions | array | Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. | [] |
161+
| sleep | integer | Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. | 0 |
162+
| width | integer | Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). | 0 |
163+
| height | integer | Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). | 0 |
164+
| quality | integer | Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. | -1 |
165+
| output | string | Output format type (jpeg, jpg, png, gif and webp). | |
166+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
use Appwrite\Client;
4+
use Appwrite\Services\Avatars;
5+
use Appwrite\Enums\Theme;
6+
use Appwrite\Enums\Timezone;
7+
use Appwrite\Enums\Output;
8+
9+
$client = (new Client())
10+
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
11+
->setProject('<YOUR_PROJECT_ID>') // Your project ID
12+
->setSession(''); // The user session to authenticate with
13+
14+
$avatars = new Avatars($client);
15+
16+
$result = $avatars->getScreenshot(
17+
url: 'https://example.com',
18+
headers: [], // optional
19+
viewportWidth: 1, // optional
20+
viewportHeight: 1, // optional
21+
scale: 0.1, // optional
22+
theme: Theme::LIGHT(), // optional
23+
userAgent: '<USER_AGENT>', // optional
24+
fullpage: false, // optional
25+
locale: '<LOCALE>', // optional
26+
timezone: Timezone::AFRICAABIDJAN(), // optional
27+
latitude: -90, // optional
28+
longitude: -180, // optional
29+
accuracy: 0, // optional
30+
touch: false, // optional
31+
permissions: [], // optional
32+
sleep: 0, // optional
33+
width: 0, // optional
34+
height: 0, // optional
35+
quality: -1, // optional
36+
output: Output::JPG() // optional
37+
);

docs/examples/databases/create-relationship-attribute.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Appwrite\Client;
44
use Appwrite\Services\Databases;
55
use Appwrite\Enums\RelationshipType;
6+
use Appwrite\Enums\RelationMutate;
67
78
$client = (new Client())
89
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint

docs/examples/databases/update-relationship-attribute.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use Appwrite\Client;
44
use Appwrite\Services\Databases;
5+
use Appwrite\Enums\RelationMutate;
56
67
$client = (new Client())
78
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint

docs/examples/functions/create-execution.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use Appwrite\Client;
44
use Appwrite\Services\Functions;
5+
use Appwrite\Enums\ExecutionMethod;
56
67
$client = (new Client())
78
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint

docs/examples/functions/create.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use Appwrite\Client;
44
use Appwrite\Services\Functions;
5-
use Appwrite\Enums\;
5+
use Appwrite\Enums\Runtime;
66
77
$client = (new Client())
88
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
@@ -14,7 +14,7 @@ $functions = new Functions($client);
1414
$result = $functions->create(
1515
functionId: '<FUNCTION_ID>',
1616
name: '<NAME>',
17-
runtime: ::NODE145(),
17+
runtime: Runtime::NODE145(),
1818
execute: ["any"], // optional
1919
events: [], // optional
2020
schedule: '', // optional

docs/examples/functions/get-deployment-download.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use Appwrite\Client;
44
use Appwrite\Services\Functions;
5+
use Appwrite\Enums\DeploymentDownloadType;
56
67
$client = (new Client())
78
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint

docs/examples/functions/update.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use Appwrite\Client;
44
use Appwrite\Services\Functions;
5+
use Appwrite\Enums\Runtime;
56
67
$client = (new Client())
78
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
@@ -13,7 +14,7 @@ $functions = new Functions($client);
1314
$result = $functions->update(
1415
functionId: '<FUNCTION_ID>',
1516
name: '<NAME>',
16-
runtime: ::NODE145(), // optional
17+
runtime: Runtime::NODE145(), // optional
1718
execute: ["any"], // optional
1819
events: [], // optional
1920
schedule: '', // optional

0 commit comments

Comments
 (0)