ircmaxell/filterus
Filterus is a lightweight PHP library for filtering and validating data with composable, object-oriented filters. It handles strings, numbers, arrays, emails, URLs, regex, ranges, and defaults, with clear error reporting for safer input handling.
Architecture fit
ircmaxell/filterus is a single-purpose, dependency-light filtering/validation library that predates many of the conventions now standard in the Laravel ecosystem. Architecturally it is a good fit only where you want a small, stateless, chainable filter API that can be used outside of Laravel's Validator pipeline — for example, normalizing and asserting invariants inside domain objects, DTOs, or value-object constructors rather than at the HTTP boundary. Its functional style (Filter::factory(), ->validate(), ->filter(), nested and per-element filtering) is composable and easy to reason about. Where it does not fit cleanly is at the framework's request-validation layer: Laravel's Validator, FormRequest, and rule objects already cover most of the same ground with better localization, error messaging, and framework integration. Treating this package as a replacement for the framework validator would create two competing validation paradigms in the codebase with no clear ownership boundary.
Integration feasibility
Installation is a standard Composer dependency with no service provider and no framework coupling, so wiring it in is low-effort: a container binding or facade is sufficient. The real feasibility question is version compatibility, because the package was authored in the PHP 5.3/5.4 era and the repository is not clearly identified in the metadata we have, which makes it hard to verify the current state of the source of truth. Concretely, we would need to confirm: PHP version constraint and whether it runs cleanly on PHP 8.x, autoloading standard (PSR-0 vs PSR-4) and any classmap conflicts, whether it emits deprecation notices or relies on removed dynamic-property / each()-era behavior, and whether its PHPUnit suite still executes. Because validation is security-adjacent, integration without a green test run on our target runtime is not acceptable.
Technical risk
filter_var, Symfony Validator, and Laravel's own rules. Duplicate mechanisms increase cognitive load and audit scope.Key questions
filter_var / Laravel rules — and can we name three that the framework cannot serve?Stack fit
Best fit is a narrow, deliberate role: a domain-level filtering utility for normalizing and asserting invariants in value objects and import/ETL pipelines, where its compact chainable API is genuinely nicer than hand-rolled checks. Poor fit is the HTTP request-validation path, where Laravel's FormRequest/Validator already provides error bags, localization, and rule extensibility. The pragmatic positioning is "adjacent to, not instead of" the framework validator.
Migration path
Adopt behind an anti-corruption layer rather than calling the library directly. Define a small internal interface (e.g., InputFilter::normalize() / InputFilter::asserts()), implement it with filterus, and bind it in the service provider. This gives three benefits: call sites never reference the third-party namespace, swapping to a fork or to native filter_var is a one-file change, and we can write our own contract tests that pin expected coercion behavior. If a maintained fork emerges, only the adapter moves.
Compatibility
Gate adoption on a compatibility spike: install in a scratch branch, run the upstream test suite plus our own contract tests on every PHP version in the support matrix, and capture deprecation output. Confirm autoloading does not conflict with Composer's optimized classmap. Verify behavior for the specific filters we intend to use (string, int, float, regex, email, array, nested) rather than assuming suite-level green means feature-level safe. Any filter we cannot get green gets excluded from the allowlist.
Sequencing
Maintenance
This is the dominant cost. Expect to own the dependency: vendor it, pin it, and budget for periodic review of PHP-version compatibility. Without an upstream maintainer, "no releases" is not stability — it means latent breakage surfaces only when we upgrade PHP or Laravel. Assign a named owner and add it to the tech-radar review cadence. Vendoring adds a small ongoing sync burden but removes the surprise factor of an abandoned Packagist entry.
Support
Community-only, best-effort, no SLA. Internal engineers will be the de facto support channel. Mitigate by keeping the adapter surface small and documentation tight — a one-page behavior reference for the filters in use pays for itself the first time someone debugs an unexpected coercion in production.
Scaling
Runtime cost is negligible: the library is stateless, in-process, and does no I/O, so horizontal scaling is unaffected. The scaling concern is organizational, not computational — every additional consumer of the library widens the audit surface and increases the cost of a future migration.
Failure modes
Ramp-up
Low for engineers. The API is small, chainable, and readable; a competent Laravel developer is productive within an hour. The real ramp-up cost is conceptual, not syntactic: teams must learn when to reach for this versus the framework validator, and must internalize the coercion semantics of each filter they use. Budget a short internal write-up and a code-review checklist entry rather than formal training. Given the low opportunity score in the metadata, treat adoption as a deliberate, contained bet — justified only if the pilot demonstrates a concrete gap the framework cannot fill — rather than a default choice.
How can I help you explore Laravel packages today?