Skip to content

Commit 8b2693a

Browse files
committed
Upgraded to support Appwrite 0.7.0
1 parent 98b327d commit 8b2693a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1229
-280
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2021 Appwrite (https://appwrite.io) and individual contributors.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Appwrite PHP SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?v=1)
4-
![Version](https://img.shields.io/badge/api%20version-0.6.0-blue.svg?v=1)
4+
![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1)
5+
6+
**This SDK is compatible with Appwrite server version 0.7.0. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).**
57

68
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
79
Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
810
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
911

10-
11-
1212
![Appwrite](https://appwrite.io/images/github.png)
1313

1414
## Installation

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "appwrite/appwrite",
3-
"description": "Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks",
3+
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
44
"type": "library",
55
"license": "BSD-3-Clause",
66
"support": {
77
"url": "https://appwrite.io/support",
8-
"email": "team@localhost.test"
8+
"email": "team@appwrite.io"
99
},
1010
"autoload": {
1111
"psr-4": {
@@ -21,4 +21,4 @@
2121
"phpunit/phpunit": "3.7.35"
2222
},
2323
"minimum-stability": "dev"
24-
}
24+
}

docs/avatars.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ GET https://appwrite.io/v1/avatars/browsers/{code}
2323
GET https://appwrite.io/v1/avatars/credit-cards/{code}
2424
```
2525

26-
** Need to display your users with your billing method or their payment methods? The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. **
26+
** The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. **
2727

2828
### Parameters
2929

3030
| Field Name | Type | Description | Default |
3131
| --- | --- | --- | --- |
32-
| code | string | **Required** Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa. | |
32+
| code | string | **Required** Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro. | |
3333
| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 |
3434
| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 |
3535
| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 |
@@ -40,7 +40,8 @@ GET https://appwrite.io/v1/avatars/credit-cards/{code}
4040
GET https://appwrite.io/v1/avatars/favicon
4141
```
4242

43-
** Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote website URL. **
43+
** Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
44+
**
4445

4546
### Parameters
4647

@@ -81,6 +82,26 @@ GET https://appwrite.io/v1/avatars/image
8182
| width | integer | Resize preview image width, Pass an integer between 0 to 2000. | 400 |
8283
| height | integer | Resize preview image height, Pass an integer between 0 to 2000. | 400 |
8384

85+
## Get User Initials
86+
87+
```http request
88+
GET https://appwrite.io/v1/avatars/initials
89+
```
90+
91+
** Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.
92+
93+
You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. **
94+
95+
### Parameters
96+
97+
| Field Name | Type | Description | Default |
98+
| --- | --- | --- | --- |
99+
| name | string | Full Name. When empty, current user name or email will be used. Max length: 128 chars. | |
100+
| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 500 |
101+
| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 500 |
102+
| color | string | Changes text color. By default a random color will be picked and stay will persistent to the given name. | |
103+
| background | string | Changes background color. By default a random color will be picked and stay will persistent to the given name. | |
104+
84105
## Get QR Code
85106

86107
```http request
@@ -96,5 +117,5 @@ GET https://appwrite.io/v1/avatars/qr
96117
| text | string | **Required** Plain text to be converted to QR code image. | |
97118
| size | integer | QR code size. Pass an integer between 0 to 1000. Defaults to 400. | 400 |
98119
| margin | integer | Margin from edge. Pass an integer between 0 to 10. Defaults to 1. | 1 |
99-
| download | integer | 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. | 0 |
120+
| 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. | |
100121

docs/database.md

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
GET https://appwrite.io/v1/database/collections
77
```
88

9-
** Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project collections. [Learn more about different API modes](/docs/admin). **
9+
** Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's collections. [Learn more about different API modes](/docs/admin). **
1010

1111
### Parameters
1212

1313
| Field Name | Type | Description | Default |
1414
| --- | --- | --- | --- |
15-
| search | string | Search term to filter your list results. | |
15+
| search | string | Search term to filter your list results. Max length: 256 chars. | |
1616
| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 |
1717
| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 |
1818
| orderType | string | Order result by ASC or DESC order. | ASC |
@@ -29,7 +29,7 @@ POST https://appwrite.io/v1/database/collections
2929

3030
| Field Name | Type | Description | Default |
3131
| --- | --- | --- | --- |
32-
| name | string | Collection name. | |
32+
| name | string | Collection name. Max length: 128 chars. | |
3333
| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | |
3434
| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | |
3535
| rules | array | Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation. | |
@@ -40,7 +40,7 @@ POST https://appwrite.io/v1/database/collections
4040
GET https://appwrite.io/v1/database/collections/{collectionId}
4141
```
4242

43-
** Get collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. **
43+
** Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. **
4444

4545
### Parameters
4646

@@ -54,14 +54,14 @@ GET https://appwrite.io/v1/database/collections/{collectionId}
5454
PUT https://appwrite.io/v1/database/collections/{collectionId}
5555
```
5656

57-
** Update collection by its unique ID. **
57+
** Update a collection by its unique ID. **
5858

5959
### Parameters
6060

6161
| Field Name | Type | Description | Default |
6262
| --- | --- | --- | --- |
6363
| collectionId | string | **Required** Collection unique ID. | |
64-
| name | string | Collection name. | |
64+
| name | string | Collection name. Max length: 128 chars. | |
6565
| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions(/docs/permissions) and get a full list of available permissions. | |
6666
| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | |
6767
| rules | array | Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation. | [] |
@@ -86,36 +86,34 @@ DELETE https://appwrite.io/v1/database/collections/{collectionId}
8686
GET https://appwrite.io/v1/database/collections/{collectionId}/documents
8787
```
8888

89-
** Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project documents. [Learn more about different API modes](/docs/admin). **
89+
** Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. [Learn more about different API modes](/docs/admin). **
9090

9191
### Parameters
9292

9393
| Field Name | Type | Description | Default |
9494
| --- | --- | --- | --- |
95-
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/database?platform=server#createCollection). | |
95+
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | |
9696
| filters | array | Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'. | [] |
97-
| offset | integer | Offset value. Use this value to manage pagination. | 0 |
98-
| limit | integer | Maximum number of documents to return in response. Use this value to manage pagination. | 50 |
99-
| orderField | string | Document field that results will be sorted by. | $id |
97+
| limit | integer | Maximum number of documents to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 |
98+
| offset | integer | Offset value. The default value is 0. Use this param to manage pagination. | 0 |
99+
| orderField | string | Document field that results will be sorted by. | |
100100
| orderType | string | Order direction. Possible values are DESC for descending order, or ASC for ascending order. | ASC |
101101
| orderCast | string | Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string. | string |
102-
| search | string | Search query. Enter any free text search. The database will try to find a match against all document attributes and children. | |
103-
| first | integer | Return only the first document. Pass 1 for true or 0 for false. The default value is 0. | 0 |
104-
| last | integer | Return only the last document. Pass 1 for true or 0 for false. The default value is 0. | 0 |
102+
| search | string | Search query. Enter any free text search. The database will try to find a match against all document attributes and children. Max length: 256 chars. | |
105103

106104
## Create Document
107105

108106
```http request
109107
POST https://appwrite.io/v1/database/collections/{collectionId}/documents
110108
```
111109

112-
** Create a new Document. **
110+
** Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](/docs/server/database#databaseCreateCollection) API or directly from your database console. **
113111

114112
### Parameters
115113

116114
| Field Name | Type | Description | Default |
117115
| --- | --- | --- | --- |
118-
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/database?platform=server#createCollection). | |
116+
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | |
119117
| data | object | Document data as JSON object. | |
120118
| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | |
121119
| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | |
@@ -129,13 +127,13 @@ POST https://appwrite.io/v1/database/collections/{collectionId}/documents
129127
GET https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId}
130128
```
131129

132-
** Get document by its unique ID. This endpoint response returns a JSON object with the document data. **
130+
** Get a document by its unique ID. This endpoint response returns a JSON object with the document data. **
133131

134132
### Parameters
135133

136134
| Field Name | Type | Description | Default |
137135
| --- | --- | --- | --- |
138-
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/database?platform=server#createCollection). | |
136+
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | |
139137
| documentId | string | **Required** Document unique ID. | |
140138

141139
## Update Document
@@ -144,11 +142,13 @@ GET https://appwrite.io/v1/database/collections/{collectionId}/documents/{docume
144142
PATCH https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId}
145143
```
146144

145+
** Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. **
146+
147147
### Parameters
148148

149149
| Field Name | Type | Description | Default |
150150
| --- | --- | --- | --- |
151-
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/database?platform=server#createCollection). | |
151+
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | |
152152
| documentId | string | **Required** Document unique ID. | |
153153
| data | object | Document data as JSON object. | |
154154
| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | |
@@ -160,24 +160,12 @@ PATCH https://appwrite.io/v1/database/collections/{collectionId}/documents/{docu
160160
DELETE https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId}
161161
```
162162

163-
** Delete document by its unique ID. This endpoint deletes only the parent documents, his attributes and relations to other documents. Child documents **will not** be deleted. **
163+
** Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted. **
164164

165165
### Parameters
166166

167167
| Field Name | Type | Description | Default |
168168
| --- | --- | --- | --- |
169-
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/database?platform=server#createCollection). | |
169+
| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | |
170170
| documentId | string | **Required** Document unique ID. | |
171171

172-
## Get Collection Logs
173-
174-
```http request
175-
GET https://appwrite.io/v1/database/collections/{collectionId}/logs
176-
```
177-
178-
### Parameters
179-
180-
| Field Name | Type | Description | Default |
181-
| --- | --- | --- | --- |
182-
| collectionId | string | **Required** Collection unique ID. | |
183-

docs/examples/avatars/get-browser.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use Appwrite\Services\Avatars;
66
$client = new Client();
77
88
$client
9+
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
910
->setProject('5df5acd0d48c2') // Your project ID
1011
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1112
;

docs/examples/avatars/get-credit-card.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use Appwrite\Services\Avatars;
66
$client = new Client();
77
88
$client
9+
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
910
->setProject('5df5acd0d48c2') // Your project ID
1011
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1112
;

docs/examples/avatars/get-favicon.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use Appwrite\Services\Avatars;
66
$client = new Client();
77
88
$client
9+
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
910
->setProject('5df5acd0d48c2') // Your project ID
1011
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1112
;

docs/examples/avatars/get-flag.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use Appwrite\Services\Avatars;
66
$client = new Client();
77
88
$client
9+
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
910
->setProject('5df5acd0d48c2') // Your project ID
1011
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1112
;

docs/examples/avatars/get-image.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use Appwrite\Services\Avatars;
66
$client = new Client();
77
88
$client
9+
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
910
->setProject('5df5acd0d48c2') // Your project ID
1011
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1112
;

0 commit comments

Comments
 (0)