Documentation Index
Fetch the complete documentation index at: https://docs.apivalk.com/llms.txt
Use this file to discover all available pages before exploring further.
Route Configuration
To enable filtering for a specific route, you use thefiltering() method on the Route object. This automatically handles the documentation and request parameter resolution.
Type-Safe Filtering
Apivalk provides specialized filter classes for different property types. Each filter is linked to its corresponding property type, ensuring that filter values are correctly type-cast when retrieved in your controller.- StringFilter: Linked to
StringProperty. Supportsequals,in,like, andcontains. - EnumFilter: Linked to
EnumProperty. Supportsequalsandin. - IntegerFilter: Linked to
IntegerProperty. Supportsequals,in,greaterThan, andlessThan. Returnsintvalues. - FloatFilter: Linked to
FloatProperty. Supportsequals,in,greaterThan, andlessThan. Returnsfloatvalues. - DateFilter: Linked to
DateProperty. Supportsequals,in,greaterThan, andlessThan. Returns\DateTimevalues. - DateTimeFilter: Linked to
DateTimeProperty. Supportsequals,in,greaterThan, andlessThan. Returns\DateTimevalues. - ByteFilter: Linked to
ByteProperty. Supportsequalsandin. - BinaryFilter: Linked to
BinaryProperty. Supportsequalsandin. - BooleanFilter: Linked to
BooleanProperty. Supportsequals. Returnsboolvalues.
- OpenAPI Accuracy: The documentation reflects the correct data type (e.g.,
number,integer,string). - Automatic Casting:
getValue()returns the correct PHP type (string,int,float, or\DateTime), ornullif the filter was not provided by the client. - Raw Access:
getRawValue()returns the original query string the client sent (e.g."2024-01-15T14:30:00+00:00"for aDateTimeFilter), ornullif the filter wasn’t provided. Useful for audit logs, error messages that quote the user’s literal input, or distinguishing “client supplied an unparseable value” (getRawValue() !== null && getValue() === null) from “client omitted the filter” (bothnull). - Detailed Documentation: You can add custom descriptions, examples, and constraints to your filters.
Supported Filter Types
StringFilter
StringFilter::equals(StringProperty $property): Exact match for a single string.StringFilter::in(StringProperty $property): Match against a list of strings.StringFilter::like(StringProperty $property): Partial string matching (e.g.,prefix%).StringFilter::contains(StringProperty $property): Match if a string contains another.
EnumFilter
EnumFilter::equals(EnumProperty $property): Exact match against allowed values.EnumFilter::in(EnumProperty $property): Match against a list of allowed values.
IntegerFilter
IntegerFilter::equals(IntegerProperty $property): Exact integer match.IntegerFilter::in(IntegerProperty $property): Match against a list of integers.IntegerFilter::greaterThan(IntegerProperty $property): Integer comparison.IntegerFilter::lessThan(IntegerProperty $property): Integer comparison.
FloatFilter
FloatFilter::equals(FloatProperty $property): Exact float match.FloatFilter::in(FloatProperty $property): Match against a list of floats.FloatFilter::greaterThan(FloatProperty $property): Float comparison.FloatFilter::lessThan(FloatProperty $property): Float comparison.
DateFilter
DateFilter::equals(DateProperty $property): Exact date match.DateFilter::in(DateProperty $property): Match against a list of dates.DateFilter::greaterThan(DateProperty $property): Date comparison.DateFilter::lessThan(DateProperty $property): Date comparison.
DateTimeFilter
DateTimeFilter::equals(DateTimeProperty $property): Exact date-time match.DateTimeFilter::in(DateTimeProperty $property): Match against a list of date-times.DateTimeFilter::greaterThan(DateTimeProperty $property): Date-time comparison.DateTimeFilter::lessThan(DateTimeProperty $property): Date-time comparison.
ByteFilter
ByteFilter::equals(ByteProperty $property): Exact byte match.ByteFilter::in(ByteProperty $property): Match against a list of byte values.
BinaryFilter
BinaryFilter::equals(BinaryProperty $property): Exact binary match.BinaryFilter::in(BinaryProperty $property): Match against a list of binary values.
BooleanFilter
BooleanFilter::equals(BooleanProperty $property): Exact boolean match. Returns aboolvalue.
Usage in Controller
When a route has filtering enabled, you can access the resolved filters from the request via thefiltering() method.
Client-Side Usage
Apivalk supports two query string formats — both reach the same filter values in your controller.Flat notation
Each filter is a top-level query parameter. Simple and compact.Bracket notation
Filters are nested under afilter key. Useful when you want a clear namespace separation from other parameters (pagination, sorting, etc.), or when tooling like OpenAPI client generators constructs nested objects.
FilterBag in your controller and can be mixed freely within a single request (flat takes precedence if both supply the same field).
OpenAPI Documentation
When you configure filters on a route, Apivalk generates a singlefilter parameter in the OpenAPI spec using style: deepObject. Each declared filter appears as a named property inside its schema:
filter[status], filter[amount], etc. — matching the bracket notation clients should use at runtime. Both flat notation (?status=active) and bracket notation (?filter[status]=active) are accepted by the server regardless of which style is chosen.
Pass flatFilters: true to OpenAPIGenerator to switch to one flat query parameter per filter instead. See OpenAPI Generator → Filter Documentation Style for the full reference.