PHPackages                             elvesora/soryxa-laravel - 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-laravel

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

elvesora/soryxa-laravel
=======================

Laravel SDK for the Soryxa email validation API

1.0.0(3mo ago)02↓92.9%MITPHPPHP ^8.1

Since Apr 3Pushed 3mo agoCompare

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

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Elvesora Soryxa Laravel SDK
===========================

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

Official Laravel SDK for the [Soryxa](https://www.elvesora.com/soryxa) email validation API. Validate email addresses in your Laravel application with a single method call and get detailed results through a clean, fluent API.

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

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, 12, or 13

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

[](#installation)

```
composer require elvesora/soryxa-laravel
```

The service provider and facade are auto-discovered. No manual registration needed.

### Publish the Config (optional)

[](#publish-the-config-optional)

```
php artisan vendor:publish --tag=soryxa-config
```

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

[](#configuration)

Add your API token to `.env`:

```
SORYXA_API_TOKEN=your-api-token
```

All available environment variables:

VariableDefaultDescription`SORYXA_API_TOKEN`*(required)*Bearer token from your Soryxa dashboard`SORYXA_TIMEOUT``30`Request timeout in seconds`SORYXA_RETRIES``0`Number of retries on 5xx errors`SORYXA_RETRY_DELAY``100`Delay between retries in milliseconds`SORYXA_SILENT_ON_LIMIT``false`Suppress usage limit exceptions (see [Silent Mode](#silent-mode))Quick Start
-----------

[](#quick-start)

```
use Elvesora\Soryxa\Facades\Soryxa;

$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
}
```

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_SILENT_ON_LIMIT=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
}
```

Dependency Injection
--------------------

[](#dependency-injection)

You can inject `SoryxaClient` directly instead of using the facade:

```
use Elvesora\Soryxa\SoryxaClient;

class EmailController
{
    public function verify(Request $request, SoryxaClient $soryxa)
    {
        $result = $soryxa->validate($request->email);

        return response()->json($result->toArray());
    }
}
```

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

[](#error-handling)

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

```
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 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 or timeout
} 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`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`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 unavailable`allow``LIMIT_EXCEEDED`Usage limit exceeded (silent mode only)License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance82

Actively maintained with recent releases

Popularity2

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

93d 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

laravelvalidationemailsoryxa

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.9k3](/packages/defstudio-telegraph)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

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

PHPackages © 2026

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