Improve Url validator to be more strict#1662
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1662 +/- ##
=========================================
Coverage 99.53% 99.53%
- Complexity 920 923 +3
=========================================
Files 190 190
Lines 2148 2171 +23
=========================================
+ Hits 2138 2161 +23
Misses 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
de54623 to
e1a5a59
Compare
henriquemoody
requested changes
Feb 1, 2026
c6efe9d to
929c89b
Compare
Previously, the URL validator accepted all kinds of URLs. Combining it with other validators like `Domain` and `Ip` manually is clumbersome, since the rules are extensive and require small tweaks such as understanding bracketed IP addresses. This change makes that composition built-in. The validator still uses the FILTER_VALIDATE_URL from PHP, but now it also goes deeper and validate portions of the URL that other validators support. Changes to `Call` were made so that it can be serialized under certain circumstances (when invoking a static method call), making it more flexible. A static internal method helper for trimming the IP was added to the Url validator class and marked as internal, as it cannot be both private, serializable and accessible to the `Call` instance all at the same time. The `@internal` annotation should advise users that it's not a public API according to phpdoc conventions.
929c89b to
f773c25
Compare
henriquemoody
approved these changes
Feb 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, the URL validator accepted all kinds of URLs.
Combining it with other validators like
DomainandIpmanually is clumbersome, since the rules are extensive and require small tweaks such as understanding bracketed IP addresses.This change makes that composition built-in. The validator still uses the FILTER_VALIDATE_URL from PHP, but now it also goes deeper and validate portions of the URL that other validators support.
Changes to
Callwere made so that it can be serialized under certain circumstances (when invoking a static method call), making it more flexible.A static internal method helper for trimming the IP was added to the Url validator class and marked as internal, as it cannot be both private, serializable and accessible to the
Callinstance all at the same time. The@internalannotation should advise users that it's not a public API according to phpdoc conventions.