Skip to content

Commit

Permalink
Updates for sandbox API mode
Browse files Browse the repository at this point in the history
  • Loading branch information
twa-team committed Jun 7, 2018
1 parent bfb380e commit b5ec305
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ $client = new QuickEmailVerification\Client('Your_API_Key_Here');
$quickemailverification = $client->quickemailverification();

try {
// PRODUCTION MODE
$response = $quickemailverification->verify("[email protected]");

// SANDBOX MODE
// $response = $quickemailverification->sandbox("[email protected]");
}
catch (Exception $e) {
echo "Code: " . $e->getCode() . " Message: " . $e->getMessage();
Expand All @@ -85,9 +89,8 @@ A successful API call responds with the following values:
- `exceeded_storage` - SMTP server rejected email. Exceeded storage allocation

- **disposable** `true | false` - *true* if the email address uses a *disposable* domain
- **accept_all** `true | false` - *true* if the domain appears to *accept all* emails delivered to that domain
- **accept_all** `true | false` - *true* if the domain appears to accept all emails delivered to that domain
- **role** `true | false` - *true* if the email address is a *role* address (`[email protected]`, `[email protected]`, etc)
- **free** `true | false` - *true* if the email address is from free email provider like Gmail, Yahoo!, Hotmail etc.
- **email** `string` - Returns a normalized version. (`[email protected]` -> `[email protected]`
- **user** `string` - The local part of an email address. (`[email protected]` -> `niki`)
- **domain** `string` - The domain of the provided email address. (`[email protected]` -> `example.com`)
Expand All @@ -113,6 +116,11 @@ QuickEmailVerification API also returns following HTTP status codes to indicate
- `404` - Requested API can not be found on server.
- `429` - Too many requests. Rate limit exceeded.

## Sandbox Mode
QuickEmailVerification single email verification API sandbox mode helps developers to test their integration against simulated results. Requesting against sandbox endpoint is totally free and no credits will be deducted from actual credit quota.

Please refer our [knowledge base](http://docs.quickemailverification.com/email-verification-api/sandbox-mode) to learn more about sandbox mode.

## License
MIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ interface QuickEmailVerificationInterface
* @throws \ErrorException|\RuntimeException
*/
public function verify($email, array $options = []);

/**
* @param $email
* @param array $options
* @return Response
* @throws \ErrorException|\RuntimeException
*/
public function sandbox($email, array $options = []);
}
15 changes: 15 additions & 0 deletions lib/QuickEmailVerification/Api/Quickemailverification.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,19 @@ public function verify($email, array $options = [])

return $this->client->get('/v1/verify', $body, $options);
}

/**
* Return predefined response for predefined email address
*
* '/v1/verify/sandbox?email=:email' GET
*
* @param $email send email address in query parameter
*/
public function sandbox($email, array $options = [])
{
$body = isset($options['query']) ? $options['query'] : [];
$body['email'] = $email;

return $this->client->get('/v1/verify/sandbox', $body, $options);
}
}
2 changes: 1 addition & 1 deletion lib/QuickEmailVerification/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class HttpClient implements HttpClientInterface
'base_uri'=>'http://api.quickemailverification.com',
'api_version' => 'v1',
'headers' => [
'user-agent' => 'quickemailverification-php/v1.0.1 (https://github.com/quickemailverification/quickemailverification-php)'
'user-agent' => 'quickemailverification-php/v1.0.2 (https://github.com/quickemailverification/quickemailverification-php)'
]
];

Expand Down

0 comments on commit b5ec305

Please sign in to comment.