aegisora/email-rule

Rule-based email validation in Aegisora ecosystem

Maintainers

Package info

github.com/Aegisora/email-rule

pkg:composer/aegisora/email-rule

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-04-27 17:35 UTC

This package is auto-updated.

Last update: 2026-04-27 17:41:20 UTC


README

Code Coverage Badge Software License PHPStan Badge

Email Rule provides a simple, rule-based email validation implementation for the Aegisora ecosystem.

It is built on top of aegisora/rule-contract (https://github.com/Aegisora/rule-contract) and follows its strict validation architecture, ensuring consistent and predictable behavior across applications.

✨ Features

  • 🔹 Lightweight and dependency-free (except rule contract)
  • 🔹 Uses native PHP email validation (filter_var)
  • 🔹 Fully compatible with Aegisora validation pipeline
  • 🔹 Strict Context → Result validation flow
  • 🔹 No raw booleans — only structured results
  • 🔹 Safe execution via base Rule abstraction
  • 🔹 Ready to use out of the box

📦 Installation

composer require aegisora/email-rule

🚀 Core Concept

This package implements a single validation rule:

  • accepts a value via Context
  • validates it as an email
  • returns a standardized Result

Validation is performed using PHP’s built-in:

filter_var($value, FILTER_VALIDATE_EMAIL)

🏗️ Basic Usage

Using EmailRule

use Aegisora\Rules\EmailRule;
use Aegisora\RuleContract\Models\Context;

$rule = EmailRule::create();
$result = $rule->validate(Context::create('user@example.com'));

if ($result->isValid()) {
// email is valid
} else {
// email is invalid
}

🧠 Implementation Details

EmailRule

  • Uses filter_var for validation
  • Returns:
    • Result::valid() result if email is correct
    • Result::invalid() result if email is incorrect
  • Does not throw exceptions for invalid emails
  • Fully relies on base Rule execution guarantees

🏛️ Architecture

This package relies on aegisora/rule-contract (https://github.com/Aegisora/rule-contract).

Flow:

  1. validate() is called
  2. executeValidate() runs
  3. Result is returned (Result)
  4. Errors (if any) are safely handled by base Rule

⚖️ License

This package is open-source and licensed under the MIT License. See the LICENSE for details.

🌱 Contributing

Contributions are welcome and greatly appreciated!. See the CONTRIBUTING for details.

🌟 Support

If you find this project useful, please consider giving it a star on GitHub!

It helps the project grow and motivates further development.