Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen:
Simple way to add a filter to Zend-InputFilter
Jun 21, 2017 @ 14:16:29

Rob Allen has a quick new post to his site sharing a simple way to add a filter to the Zend-InputFilter component when it's in use on your site.

Using Zend-InputFilter is remarkably easy to use. [...] How do you add your filter to it though?

He starts with an example of putting the component to use in requiring and filtering the value in "my_field" for the data provided. He then shows how to add his "simple filter that does absolutely nothing", the MyFilter, to the current set. He also shows the creation of a "filter factory" class that registers the custom filter into the chain with an alias of "MyFIlter". You can then use it just like you would any other filter and define it in your rules specification.

tagged: zendframework zendinputfilter component custom filter tutorial factory

Link: https://akrabat.com/simple-way-to-add-a-filter-to-zend-inputfilter/


Trending Topics: