Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Appwrite PHP SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1)
![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square&v=1)
![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square&v=1)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).**
**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).**

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. Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)

Expand Down
106 changes: 101 additions & 5 deletions docs/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,33 @@ POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
| type | string | **Required** Type of authenticator. Must be `totp` | |


```http request
POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
```

** Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| type | string | **Required** Type of authenticator. Must be `totp` | |


```http request
PUT https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
```

** Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| type | string | **Required** Type of authenticator. | |
| otp | string | Valid verification token. | |


```http request
PUT https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
```
Expand Down Expand Up @@ -139,6 +166,32 @@ DELETE https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
| type | string | **Required** Type of authenticator. | |


```http request
DELETE https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
```

** Delete an authenticator for a user by ID. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| type | string | **Required** Type of authenticator. | |


```http request
POST https://cloud.appwrite.io/v1/account/mfa/challenge
```

** Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| factor | string | Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. | |


```http request
POST https://cloud.appwrite.io/v1/account/mfa/challenge
```
Expand Down Expand Up @@ -166,6 +219,27 @@ PUT https://cloud.appwrite.io/v1/account/mfa/challenge
| otp | string | Valid verification token. | |


```http request
PUT https://cloud.appwrite.io/v1/account/mfa/challenge
```

** Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| challengeId | string | ID of the challenge. | |
| otp | string | Valid verification token. | |


```http request
GET https://cloud.appwrite.io/v1/account/mfa/factors
```

** List the factors available on the account to be used as a MFA challange. **


```http request
GET https://cloud.appwrite.io/v1/account/mfa/factors
```
Expand All @@ -180,6 +254,20 @@ GET https://cloud.appwrite.io/v1/account/mfa/recovery-codes
** Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. **


```http request
GET https://cloud.appwrite.io/v1/account/mfa/recovery-codes
```

** Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. **


```http request
POST https://cloud.appwrite.io/v1/account/mfa/recovery-codes
```

** Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. **


```http request
POST https://cloud.appwrite.io/v1/account/mfa/recovery-codes
```
Expand All @@ -194,6 +282,13 @@ PATCH https://cloud.appwrite.io/v1/account/mfa/recovery-codes
** Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. **


```http request
PATCH https://cloud.appwrite.io/v1/account/mfa/recovery-codes
```

** Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. **


```http request
PATCH https://cloud.appwrite.io/v1/account/name
```
Expand Down Expand Up @@ -415,15 +510,16 @@ PATCH https://cloud.appwrite.io/v1/account/status
POST https://cloud.appwrite.io/v1/account/tokens/email
```

** Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
** Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.

A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). **
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
**

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| userId | string | User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | |
| userId | string | User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. | |
| email | string | User email. | |
| phrase | boolean | Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. | |

Expand All @@ -441,7 +537,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| userId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | |
| userId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. | |
| email | string | User email. | |
| url | string | URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | |
| phrase | boolean | Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. | |
Expand Down Expand Up @@ -479,7 +575,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| userId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | |
| userId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. | |
| phone | string | Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | |


Expand Down
Loading