PHPackages                             elvesora/soryxa-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. elvesora/soryxa-php

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

elvesora/soryxa-php
===================

Pure PHP SDK for the Soryxa email validation API

1.0.0(3mo ago)00MITPHPPHP ^8.1

Since Apr 3Pushed 3mo agoCompare

[ Source](https://github.com/Elvesora/soryxa-php)[ Packagist](https://packagist.org/packages/elvesora/soryxa-php)[ RSS](/packages/elvesora-soryxa-php/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Elvesora Soryxa PHP SDK
=======================

[](#elvesora-soryxa-php-sdk)

Pure PHP SDK for the [Soryxa](https://www.elvesora.com/soryxa) email validation API. Zero external dependencies — works in any PHP project.

Requirements
------------

[](#requirements)

- PHP 8.1+
- ext-curl
- ext-json

Installation
------------

[](#installation)

```
composer require elvesora/soryxa-php
```

Quick Start
-----------

[](#quick-start)

```
use Elvesora\SoryxaPHP\SoryxaClient;

$soryxa = new SoryxaClient(token: 'your-api-token');

$result = $soryxa->validate('user@example.com');

if ($result->isAllowed()) {
    // Email is valid — proceed
}

if ($result->isBlocked()) {
    // Email failed validation — reject
}

if ($result->needsReview()) {
    // Email is risky — flag for manual review
}
```

Configuration
-------------

[](#configuration)

All configuration is passed to the constructor:

```
$soryxa = new SoryxaClient(
    token: 'your-api-token',                      // Required
    baseUrl: 'https://soryxa.elvesora.com',        // Default
    timeout: 30,                                   // Seconds
    retries: 0,                                    // Retry count on 5xx errors
    retryDelay: 100,                               // Delay between retries (ms)
    silentOnLimit: false,                           // Suppress usage limit exceptions
);
```

ParameterDefaultDescription`token`*(required)*Bearer token from your Soryxa dashboard`baseUrl``https://soryxa.elvesora.com`API base URL`timeout``30`Request timeout in seconds`retries``0`Number of retries on 5xx errors`retryDelay``100`Delay between retries in milliseconds`silentOnLimit``false`Suppress usage limit exceptions (see [Silent Mode](#silent-mode))Validation Result
-----------------

[](#validation-result)

The `validate()` method returns a `ValidationResult` object with access to all validation data through public properties and helper methods.

### Decision

[](#decision)

```
$result = $soryxa->validate('user@example.com');

// Access as properties
$result->decision;        // 'allow', 'block', or 'review'
$result->reasonCode;      // e.g. 'CLASSIFICATION_VALID'
$result->decisionMessage; // 'Email passed all validation checks'
$result->decisionReasons; // ['Valid email with high quality score']
$result->score;           // 0–100

// Or as methods
$result->decision();
$result->reasonCode();
$result->decisionMessage();
$result->decisionReasons();
$result->score();
```

#### Decision Helpers

[](#decision-helpers)

```
$result->isAllowed();       // true when decision is 'allow'
$result->isBlocked();       // true when decision is 'block'
$result->needsReview();     // true when decision is 'review'
$result->isLimitExceeded(); // true when usage limit was silently exceeded
```

### Email &amp; Identity

[](#email--identity)

```
$result->email();          // 'user@example.com'
$result->username();       // 'user'
$result->domain();         // 'example.com'
$result->firstName();      // 'John' or null
$result->lastName();       // 'Doe' or null
$result->classification(); // 'valid', 'risky', or 'invalid'
```

### Boolean Check Helpers

[](#boolean-check-helpers)

Quick boolean shortcuts to inspect specific validation checks:

```
// Syntax & DNS
$result->isSyntaxValid();          // Email format is valid
$result->hasMxRecords();           // Domain has MX records
$result->isSmtpValid();            // SMTP verification passed
$result->isDomainRegistered();     // Domain is registered
$result->isNewlyRegisteredDomain(); // Domain was recently registered

// Email classification
$result->isDisposable();           // Disposable/temporary email
$result->isFreeProvider();         // Free email provider (Gmail, Yahoo, etc.)
$result->isFree();                 // Alias for isFreeProvider()
$result->isRoleAccount();          // Role-based address (info@, admin@, etc.)
$result->isRole();                 // Alias for isRoleAccount()
$result->isBogus();                // Username matches known bogus patterns
$result->isCatchAll();             // Domain accepts any address
```

### Individual Checks

[](#individual-checks)

Each validation response includes an array of `Check` objects with detailed results for every check performed:

```
foreach ($result->checks as $check) {
    $check->name;    // e.g. 'Syntax Check', 'Domain MX', 'SMTP Verification'
    $check->status;  // 'passed', 'failed', 'warning', or 'error'
    $check->message; // 'Valid email format'

    $check->passed();    // true if status is 'passed'
    $check->failed();    // true if status is 'failed'
    $check->isWarning(); // true if status is 'warning'
    $check->isError();   // true if status is 'error'
}
```

#### Filtering Checks

[](#filtering-checks)

```
// Get a specific check by name (case-insensitive)
$mx = $result->getCheck('Domain MX');
if ($mx && $mx->passed()) {
    // MX records are valid
}

// Get all checks that passed
$passed = $result->passedChecks();

// Get all checks that failed
$failed = $result->failedChecks();

// Get all checks with warnings
$warnings = $result->warningChecks();
```

### Usage Tracking

[](#usage-tracking)

Every response includes your current API credit usage:

```
$result->usage->remaining;      // Credits remaining
$result->usage->limit;          // Total credit limit
$result->usage->usagePercent(); // Percentage consumed (0–100)
```

### Serialization

[](#serialization)

All response objects (`ValidationResult`, `Check`, `Usage`) can be converted to arrays:

```
$array = $result->toArray();
```

Silent Mode
-----------

[](#silent-mode)

By default, exceeding your API usage limit throws a `UsageLimitException`. If you prefer your application to continue without interruption, enable silent mode:

```
$soryxa = new SoryxaClient(
    token: 'your-api-token',
    silentOnLimit: true,
);
```

When silent mode is enabled and the usage limit is exceeded, `validate()` will **not** throw an exception. Instead, it returns a `ValidationResult` with:

- `decision` set to `"allow"` — so your application flow continues
- `reasonCode` set to `"LIMIT_EXCEEDED"`
- `decisionMessage` set to `"You have exceeded your monthly usage limit."`
- `score` set to `0`
- All boolean check helpers (`isDisposable()`, `isFree()`, etc.) return `false`
- `email()`, `username()`, and `domain()` still return the input values
- `checks` is an empty array
- `classification()`, `firstName()`, `lastName()` return `null`

Use `isLimitExceeded()` to detect this state and handle it in your application:

```
$result = $soryxa->validate('user@example.com');

if ($result->isLimitExceeded()) {
    // Usage limit hit — result is a passthrough "allow"
    // Log it, notify admin, etc.
}

// Your normal flow continues either way
if ($result->isAllowed()) {
    // proceed
}
```

Error Handling
--------------

[](#error-handling)

Every API error throws a specific exception extending `SoryxaException`:

```
use Elvesora\SoryxaPHP\SoryxaClient;
use Elvesora\SoryxaPHP\Exceptions\AuthenticationException;
use Elvesora\SoryxaPHP\Exceptions\SubscriptionException;
use Elvesora\SoryxaPHP\Exceptions\InsufficientScopeException;
use Elvesora\SoryxaPHP\Exceptions\ValidationException;
use Elvesora\SoryxaPHP\Exceptions\UsageLimitException;
use Elvesora\SoryxaPHP\Exceptions\ServerException;
use Elvesora\SoryxaPHP\Exceptions\ConnectionException;
use Elvesora\SoryxaPHP\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 required scope
} catch (ValidationException $e) {
    // 422 — Invalid input (e.g. malformed email)
} catch (UsageLimitException $e) {
    // 429 — Usage limit exceeded
} catch (ServerException $e) {
    // 5xx — Server-side error
} catch (ConnectionException $e) {
    // Network failure, timeout, or invalid response
} catch (SoryxaException $e) {
    // Catch-all for any other API error
}
```

### Common Exception Methods

[](#common-exception-methods)

Every exception provides these methods:

```
$e->getMessage();       // Human-readable error message
$e->getErrorCode();     // API error code (e.g. 'TOKEN_EXPIRED')
$e->getStatusCode();    // HTTP status code (e.g. 401)
$e->getResponseBody();  // Full API response as array
```

### Exception-Specific Helpers

[](#exception-specific-helpers)

#### AuthenticationException (401)

[](#authenticationexception-401)

```
$e->isTokenExpired();  // Token has expired
$e->isInvalidToken();  // Token is invalid
$e->isMissingToken();  // No token provided
```

#### SubscriptionException (402)

[](#subscriptionexception-402)

```
$e->hasNoSubscription(); // No subscription found
$e->isInactive();        // Subscription is inactive
```

#### InsufficientScopeException (403)

[](#insufficientscopeexception-403)

```
$e->getRequiredScopes(); // ['validate']
```

#### ValidationException (422)

[](#validationexception-422)

```
$e->getValidationErrors(); // ['email' => ['The email field is required.']]
```

#### UsageLimitException (429)

[](#usagelimitexception-429)

```
$e->getLimit();       // Total credit limit
$e->getUsed();        // Credits used
$e->getRemaining();   // Credits remaining
$e->getPeriodEndsAt(); // Period end date (e.g. '2026-05-01')
```

### Exception Reference

[](#exception-reference)

ExceptionHTTP StatusError Codes`AuthenticationException`401`INVALID_AUTH_HEADER`, `MISSING_TOKEN`, `INVALID_TOKEN`, `TOKEN_EXPIRED`, `TEAM_NOT_FOUND`, `TOKEN_NOT_FOUND``SubscriptionException`402`NO_SUBSCRIPTION`, `SUBSCRIPTION_INACTIVE``InsufficientScopeException`403`INSUFFICIENT_SCOPE``ValidationException`422`VALIDATION_ERROR``UsageLimitException`429`USAGE_LIMIT_EXCEEDED`, `INSUFFICIENT_CREDITS``ServerException`5xx`USAGE_CHECK_ERROR``ConnectionException`—`CONNECTION_ERROR`, `INVALID_RESPONSE`Decision Reference
------------------

[](#decision-reference)

The `decision` field will be one of three values:

DecisionMeaning`allow`Email passed validation`block`Email failed validation or matched a block rule`review`Email is risky and requires manual review### Reason Codes

[](#reason-codes)

DecisionReason CodeDescription`allow``ALLOW_LIST_MATCH`Email matched your allow list`allow``CLASSIFICATION_VALID`Email classified as valid`allow``DEFAULT_ALLOW`No rules triggered — allowed by default`allow``LIMIT_EXCEEDED`Usage limit exceeded (silent mode only)`block``BLOCK_LIST_MATCH`Email matched your block list`block``BLOCK_DISPOSABLE`Disposable email address`block``BLOCK_FREE_PROVIDER`Free email provider blocked by rules`block``BLOCK_ROLE_ACCOUNT`Role-based address (e.g. info@, admin@)`block``BLOCK_BOGUS_DOMAIN`Domain is bogus or non-existent`block``SCORE_BELOW_BLOCK_THRESHOLD`Score below configured block threshold`block``CLASSIFICATION_INVALID`Email classified as invalid`review``SCORE_BELOW_THRESHOLD`Score below review threshold`review``CLASSIFICATION_RISKY`Email classified as risky`review``DISPOSABLE_REVIEW`Disposable address flagged for review`review``SERVICE_UNAVAILABLE`Upstream check unavailableFramework Integration
---------------------

[](#framework-integration)

This package is framework-agnostic. For Laravel projects, use the [elvesora/soryxa-laravel](https://github.com/elvesora/soryxa-laravel) package instead, which provides a service provider, facade, and config file out of the box.

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

90d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/541009b7a92054d76583bac137139b098c30f23a4b6c9cce01a6c0f600c16ddc?d=identicon)[WebRegulus](/maintainers/WebRegulus)

---

Top Contributors

[![WebRegulus](https://avatars.githubusercontent.com/u/46540140?v=4)](https://github.com/WebRegulus "WebRegulus (1 commits)")

---

Tags

phpvalidationemailsoryxa

### Embed Badge

![Health badge](/badges/elvesora-soryxa-php/health.svg)

```
[![Health](https://phpackages.com/badges/elvesora-soryxa-php/health.svg)](https://phpackages.com/packages/elvesora-soryxa-php)
```

###  Alternatives

[stymiee/email-validator

A robust PHP 7.4+ email validation library that extends beyond basic validation with MX record checks, disposable email detection, and free email provider validation. Features include strict typing, custom validator support, internationalization (i18n), and an extensible architecture. Perfect for applications requiring thorough email verification with customizable validation rules.

33487.3k1](/packages/stymiee-email-validator)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

254168.5k](/packages/erag-laravel-disposable-email)[martian/spammailchecker

A laravel package that protect users from entering non-existing/spam email addresses.

422.1k](/packages/martian-spammailchecker)[henrique-borba/php-sieve-manager

A modern (started in 2022) PHP library for the ManageSieve protocol (RFC5804) to create/edit Sieve scripts (RFC5228). Used by Cypht Webmail.

28142.6k4](/packages/henrique-borba-php-sieve-manager)[ashallendesign/laravel-mailboxlayer

A lightweight Laravel package for validating emails using the Mailbox Layer API.

772.2k](/packages/ashallendesign-laravel-mailboxlayer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
