Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Filter Var

Laravel Filter Var Laravel Package

aporat/laravel-filter-var

A lightweight Laravel validation rule that wraps PHP's filter_var function, letting you validate emails, URLs, IP addresses, booleans, and other values with native filters inside form requests and custom validators. Simple to use wherever Laravel's validator is available.

View on GitHub
Deep Wiki
Context7

A Laravel package for filtering and sanitizing request variables with customizable rules

Frequently asked questions about Laravel Filter Var
How do I install aporat/laravel-filter-var?
Install it with Composer using composer require aporat/laravel-filter-var. It is a lightweight wrapper around PHP's native filter_var function and does not pull in extra dependencies. After installation, use the provided rule or helper wherever Laravel's validator is available.
Which Laravel versions are supported by aporat/laravel-filter-var?
The provided context does not pin a specific Laravel version range, so check the package's composer.json and README for the supported illuminate/validation constraint. It is designed to work alongside Laravel's standard validation workflow. Test it against your app's Laravel version before upgrading or deploying.
How do I use filter_var validation in a Laravel form request?
Add the package's rule or helper to your form request's rules array, just like any other Laravel validation rule. It exposes FILTER_VALIDATE_* filters for common values such as emails, URLs, IP addresses, integers, and booleans. Because it integrates with Laravel's validator, it also works in controllers and custom validators.
Can I pass custom flags or options to the filter_var rule?
Yes, the package supports custom flags and options for precise validation. This is useful when you need filter_var behavior for edge cases beyond the default filter settings. Use the package's documented syntax for passing flags to the rule in your Laravel validation array.
What is the difference between this package and Laravel's built-in email, url, or ip validation rules?
Laravel's built-in email, url, ip, integer, and boolean rules cover many common validation cases. This package wraps PHP's native FILTER_VALIDATE_* filters, which can be useful when you want filter_var semantics or custom flags. It is lightweight and dependency-free, but built-in rules may be simpler for standard use cases.
How do I test validation using aporat/laravel-filter-var?
Test it like any Laravel validation rule by passing valid and invalid values through the validator. Use PHPUnit or Pest with Laravel's validation test helpers and assert that the rule passes or fails as expected. Add cases for any custom flags or options you use.
Is aporat/laravel-filter-var safe for production use?
It is a lightweight wrapper around PHP's native filter_var function, so the core validation behavior comes from PHP itself. Still, review the package's maintenance status, test coverage, and supported Laravel versions before relying on it in production. Pin the version in composer.json and rerun your validation tests after upgrades.
What values can I validate with this Laravel filter_var package?
It exposes FILTER_VALIDATE_* filters, so you can validate common values such as emails, URLs, IP addresses, integers, and booleans. The exact list depends on the PHP filters exposed by the package. It is intended for native filter_var-style validation inside Laravel's validator.
Does aporat/laravel-filter-var work with Laravel's validator and custom validation rules?
Yes, it is designed to work alongside Laravel's standard validation workflow. You can use the provided rule or helper in form requests, controller validation, or custom validators wherever Laravel's validator is available. It adds native filter_var-based rules rather than replacing Laravel's validator.
Are there alternatives to aporat/laravel-filter-var for Laravel validation?
Laravel's built-in email, url, ip, integer, and boolean rules cover many common cases without extra packages. Other community validation packages may offer broader or more specialized rule sets. This package is best when you specifically want PHP filter_var filters and custom flags in Laravel.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log