- How do I install madeitbelgium/laravel-email-domain-validation?
- Install it with Composer using composer require madeitbelgium/laravel-email-domain-validation, then let Laravel package auto-discovery register the service provider. Publish any config file if the package ships one, and apply the custom rule to the specific form requests or validators where you want domain checks. Always confirm the package's Composer constraints resolve against your app's Laravel and PHP versions in a throwaway branch first.
- What exactly does this package check — MX records, disposable domains, or just syntax?
- The package targets the domain portion of an email address, typically via DNS/MX lookups, so it goes beyond Laravel's syntax-only validation. Whether it also flags disposable or free providers, and how it handles IDN/punycode and subdomains, depends on the bundled logic and must be confirmed from source. Disposable-domain lists decay quickly, so check whether any list is bundled, fetched at runtime, or configurable.
- Does this package duplicate Laravel's built-in email:dns validation rule?
- Partly — Laravel already offers email:dns, email:spoof, and email:strict, which perform DNS checks natively. The incremental value here has to come from disposable-domain detection, allow/deny lists, or result caching; if it only re-implements MX lookups, adding the dependency is hard to justify. Compare the rule's behavior against email:dns in a branch before adopting.
- Which Laravel and PHP versions does this package support?
- Support is defined entirely by the package's composer.json constraints, so verify them against your installed Laravel and PHP matrix. Run composer require in a throwaway branch and let Composer resolve the constraint set rather than trusting the README. Also confirm the package has a test suite, ideally one that mocks DNS, before relying on it.
- Is the LGPL-3.0 license a problem for a commercial Laravel application?
- For PHP, an autoloaded source distribution generally satisfies LGPL relinking requirements, so commercial use is normally fine. However, LGPL appears on many corporate license blocklists and may require excluding the package from bundled or compiled distribution artifacts. Budget an explicit legal review; do not ship before it clears.
- What happens if the DNS lookup times out or returns SERVFAIL during validation?
- This is the most consequential unknown: the rule may fail open (accept the email) or fail closed (reject it), and either choice affects registration and login flows. Read the source to confirm the behavior rather than relying on documentation, and test with simulated DNS timeouts. Any DNS call in the request path also adds latency and a new failure mode.
- Does the package cache DNS results or call any external HTTP APIs?
- Caching matters because validation runs on signup and contact forms, and repeated DNS lookups add latency. Confirm from source whether lookups are cached, and where — in-memory, Laravel's cache, or not at all. Also check whether the rule calls an external HTTP service, which would carry privacy and DPA implications.
- How do I test this validation rule without relying on real DNS?
- Look for a test suite that mocks DNS resolution, and mirror that approach in your own tests so CI does not depend on network access. In feature tests, fake the underlying DNS resolver or bind a stub implementation. If the package is not test-friendly, wrap the rule behind your own validator so you can swap it out.
- How can I disable email domain validation in production without a deploy?
- Because the rule is purely additive and runs only where applied, you can gate it behind a config value such as EMAIL_DOMAIN_VALIDATION_ENABLED read from the environment. Then conditionally add the rule to your form requests instead of hardcoding it. This lets you toggle the check off instantly if DNS issues cause signup failures.
- Is it worth adding this package or should I write my own MX validation rule?
- The code footprint is small enough to fork and own, which is the main mitigation for the low star count and single-maintainer bus factor. If you only need MX checks, Laravel's native email:dns may already cover you; if you need disposable-domain detection, decide whether to own that list yourself. Treat the package as a leaf dependency and nothing else in your stack should depend on it.