1. Go to this page and download the library: Download elvesora/soryxa-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
elvesora / soryxa-laravel example snippets
use Elvesora\Soryxa\Facades\Soryxa;
$result = Soryxa::validate('[email protected]');
if ($result->isAllowed()) {
// Email is valid; proceed.
}
if ($result->isBlocked()) {
// Email failed validation or matched a block rule.
}
if ($result->needsReview()) {
// Email needs manual review or safe fallback handling.
}
$result = Soryxa::validate('[email protected]');
if ($result->isLimitExceeded()) {
// Log, alert, queue for review, or ask the customer to retry later.
}
use Elvesora\Soryxa\SoryxaClient;
use Illuminate\Http\Request;
class EmailController
{
public function verify(Request $request, SoryxaClient $soryxa)
{
$result = $soryxa->validate(
$request->email,
'signup',
['X-Soryxa-Correlation-Id' => (string) $request->headers->get('X-Request-Id')],
);
return response()->json($result->toArray());
}
}
use Elvesora\Soryxa\Facades\Soryxa;
use Elvesora\Soryxa\Exceptions\AuthenticationException;
use Elvesora\Soryxa\Exceptions\SubscriptionException;
use Elvesora\Soryxa\Exceptions\InsufficientScopeException;
use Elvesora\Soryxa\Exceptions\ValidationException;
use Elvesora\Soryxa\Exceptions\UsageLimitException;
use Elvesora\Soryxa\Exceptions\ServerException;
use Elvesora\Soryxa\Exceptions\ConnectionException;
use Elvesora\Soryxa\Exceptions\SoryxaException;
try {
$result = Soryxa::validate($email);
} catch (AuthenticationException $e) {
// 401: invalid, expired, or missing token.
} catch (SubscriptionException $e) {
// 402: no active subscription.
} catch (InsufficientScopeException $e) {
// 403: token lacks