HTTP RESTful typed-parameter Routing
In any application, we cannot trust the users' input to the application. Many security attacks going on has been a constant reminder for web developers, especially in PHP, to filter any input and harden their application to minimize the risk of a successful attack. Packfire Framework offers you typed-parameter routing to your controller actions. This gives you great advantage as you are able to control the input parameters and routing at the same place in the `routing.yml` file. Even before execution reaches your controller action, you can determine if the data-type of parameters is valid or not. In your routing configuration file **routing.yml**, routing parameters can be the following: - **any**: any input provided - **optional**: ignores validation if this is set and input is null - **int, integer, long**: input provided must be an integer - **real, float, double**: input provided must be a double - **email**: input must be a valid email address format - **alpha**: input must contain alphabets only - **numeric**: input must be numerical (double or integer) - **alnum**: input must be alphanumerical (alphabets and numbers) - **regex/{match}**: input must match regular expression {match} - **param/{key}**: input must match fellow input parameter {key} - **value/{value}**, equals/{value}, equal/{value}: input must match {value} - **min/{value}**: input must be at least {value} - **max/{value}**: input must be at most {value} - **strmin/{value}**: input length must be at least {value} - **strmax/{value}**: input length must be at most {value} For example: # pack/config/routing.yml user.view: rewrite: /users/{id}-{name} method: 'get' actual: 'Users:view' params: id: num name: alnum If the parameters do not match the parameter typing specified, the route entry will not match. So given a 'GET /users/alpha-ru!n' request will not match the example route above and will cause a HTTP 404 Not Found. > By the way, the ordering of the parameters in the `params` entry does not need to match the order of your controller action. Packfire Framework automatically detects your method parameters list for the data to be passed into your controller action correctly. Voilà! Validation and filtering made simple for you and you can just concentrate on the business / application logic alone. Worry less with Packfire Framework for PHP.















