Filterus to bardzo praktyczna biblioteka do filtrowania danych. Dzięki niej sprawdzimy poprawność danych wysyłanych poprzez formularze na stronie internetowej. Filterus posiada mnogą ilość opcji, która w zupełności wystarczy, aby samodzielnie obsłużyć witrynę z najróżniejszymi formatami danych.

Co tak naprawdę potrafi Filterus, przedstawia poniższa lista filtrów, w raz z dostępnymi opcjami dla nich.

  • alnum – Alpha numeric
    • min – 0 – Minimum length
    • max – PHP_INT_MAX – Maximum length
    • default – '' – Default return value
  • array – Array matching
    • min – 0 – Minimum size
    • maximum – PHP_INT_MAX – Maxim size
    • keys – null – Filter to run on the keys
    • values – null – Filter to run on the values
    • default – array() – Default return value
  • bool – Boolean matching
    • default – null – Default return value
  • email – Matches emails
  • float – Floating point numbers
    • min – null – Minimum length
    • max – null – Maximum length
    • default – 0.0 – Default return value
  • int – Integers numbers
    • min – null – Minimum length
    • max – null – Maximum length
    • default – 0 – Default return value
  • ip – Matches IP addresses
    • ipv4 – true – Boolean to match IPv4 addresses
    • ipv6 – true – Boolean to match IPv6 addresses
    • private – true – Include private addresses?
    • reserved – true – Include reserved addresses?
  • object – Objects
    • class – '' – Required class or interface name
    • default – null – The default value
    • defaultFactory – null – A callback to instantiate a return value
  • raw – Returns whatever is passed in
  • regex – Matches strings via a regex
    • min – 0 – Minimum length
    • max – PHP_INT_MAX – Maximum length
    • default – '' – Default return value
    • regex – /.?/ – The regex to run
  • string – Matches strings
    • min – 0 – Minimum length
    • max – PHP_INT_MAX – Maximum length
    • default – '' – Default return value
  • url – Matches URLs
    • path – false – Force a path to be present
    • query – false – Force a query string to be present

1 KOMENTARZ

ZOSTAW ODPOWIEDŹ