use Symfony\Component\OptionsResolver\OptionsResolverInterface; $optionsResolver = new OptionsResolverInterface(); $optionsResolver->setDefined(array( 'filterType', 'sortOrder', 'perPage' )); $optionsResolver->setRequired(array( 'filterType', 'sortOrder' )); $optionsResolver->setAllowedValues('filterType', array( 'author', 'title', 'date' )); $optionsResolver->setAllowedValues('sortOrder', array( 'asc', 'desc' )); $optionsResolver->setDefaults(array( 'perPage' => 10 )); $options = $optionsResolver->resolve($userInput);In this example, we first create a new instance of the OptionsResolverInterface, and use the setDefined method to define all of the possible input options. Note that we also use setRequired to specify which options are required, and setDefaults to provide default values for any that aren't provided in the user input. The real power of this component comes with the setAllowedValues method, which we use to ensure that the filterType and sortOrder options can only be set to a specific set of values. This prevents the user from passing any unexpected or invalid values, and ensures that our search function will always work as expected. Overall, the OptionsResolverInterface is a key component of the Symfony PHP framework that can help developers to easily validate and handle user input in a robust and flexible way.