h-farm/laravel-email-domain-rule
A Laravel validation rule for checking the domain of an email address. Allow or block specific domains, filter disposable or corporate emails, and get clear validation messages—drop it into form requests or validators with minimal setup.
Architecture fit. maize-tech/laravel-email-domain-rule is a narrow, single-purpose validation package: it registers a custom Laravel validation rule (and matching service provider / config surface) for constraining which email domains are acceptable on a given field. Architecturally this is the lowest-risk integration shape available in Laravel — it plugs into the framework's native validator extension points rather than introducing a new runtime, a facade with global state, or middleware into the request lifecycle. It does not touch persistence, queueing, auth, or the container in ways that would constrain application design. Fit is good for form requests, Validator::make() calls, and Filament/Livewire form definitions, provided the team is comfortable expressing domain policy as a rule string rather than as domain logic in a service class.
Integration feasibility. Composer-only dependency with no infrastructure prerequisites, no migrations, and no external service account. Expected footprint is a composer require, an optional php artisan vendor:publish for the config, and one rule string per validated field. Realistic effort for a first working integration is well under a day; the dominant cost is policy definition (which domains to allow or deny), not wiring.
Technical risk. Code-level risk is low: small surface area, no I/O expectations stated, and the 3.2.0 release is a compatibility bump rather than a behavioural change. The material risks are elsewhere:
maize-tech) with a small contributor set. Historically the project has tracked framework majors reactively — this release adds Laravel 11.x and PHP 8.3 support roughly in line with the framework's own release cadence, which is reassuring but implies that a future Laravel 12 would similarly require a maintainer-initiated PR. Treat framework-upgrade timing as partially outside our control.composer.json between 3.1.x and 3.2.0 rather than trusting the semver alone.Key questions.
composer.json constraints for laravel/framework, illuminate/*, and php after this release? Does it still support Laravel 10, or did 3.2.0 silently drop it?Stack fit. Targets Laravel applications on the 9.x–11.x line with PHP 8.1–8.3, assuming 3.2.0 widened rather than replaced constraints. Integration is idiomatic: the rule composes with required, email, max, and unique in the same rule array, and works identically in form requests, closures, and programmatic validators. It sits alongside — not in conflict with — Illuminate\Validation\Rules\Email and DNS-based rules such as email:dns / spoof, though overlapping DNS checks should be consolidated to avoid duplicate lookups.
Migration path. For an application already on 3.x, this is a routine composer update maize-tech/laravel-email-domain-rule with no code changes anticipated. For an application pinned to 2.x, treat 3.2.0 as a major-step upgrade: review the 3.0.0 breaking changes (namespace, config key names, rule signature), then step directly to 3.2.0 rather than landing on an intermediate. For greenfield adoption, install 3.2.0 directly and pin with a caret constraint (^3.2).
Compatibility. The two stated changes — PHP 8.3 and Laravel 11.x — are the compatibility items that matter, and both land in this release. Verify in the lockfile that the widened constraints do not collide with other transitive illuminate/support requirements; on Laravel 11 projects this is usually clean, but packages pinned to ^9.0|^10.0 will force a resolution failure. Confirm the rule is registered by the package's auto-discovered service provider — if the application sets dont-discover, the provider must be registered manually or the rule string will throw a "validation rule does not exist" error at runtime, which surfaces only when the field is validated.
Sequencing.
composer.json diff for 3.1.x → 3.2.0, and answer the key questions above — especially corpus sourcing and network behaviour.Maintenance. Expect low, bursty maintenance: near-zero between framework majors, then a required dependency bump whenever Laravel ships. Budget one small ticket per Laravel major release to validate the package has caught up; the 3.2.0 timing suggests the maintainers track reasonably promptly, but there is no SLA and no vendor contract behind it. Pin the constraint and let Renovate/Dependabot surface releases rather than floating.
Support. Community-only support via GitHub issues. For a security-adjacent validation rule this is acceptable given the small code surface and the fact that the rule is not a security control — it is a policy filter. Do not use it as the sole defence against abuse; pair it with rate limiting and email verification. Retain the option to vendor the source into the repo if the package goes dormant, which is a few hours of work given the size.
Scaling. Negligible if the rule evaluates a static, in-memory domain set — it is a hash lookup on a string already in memory, and adds nothing measurable to request latency. If instead it performs DNS/MX resolution per validation, cost scales with signup volume and is exposed to resolver latency and outages; in that case require caching of results per domain and a short timeout with fail-open behaviour, otherwise a DNS blip becomes a signup outage. Confirm which case applies before assuming the cheap one.
Failure modes.
Ramp-up. Hours for any engineer already fluent in Laravel validation; the package introduces no new mental model beyond "it's a rule string." The real ramp-up cost sits with product/trust-and-safety in defining and owning the domain policy, and that cost recurs every time the list is revisited. Document the policy rationale next to the config so the next engineer knows why a domain is excluded, not just that it is.
How can I help you explore Laravel packages today?