In Slim 2, we have a static route method called 'setDefaultConditions' where we can pre-define route names with regular expressions.
Route::setDefaultConditions(
array(
'product_id' => Regex::VALID_PRODUCT_ID,
'id' => Regex::VALID_NUM,
'cart_id' => Regex::VALID_CART_ID,
'session_id' => Regex::VALID_SESSION_ID,
'access_token' => Regex::VALID_ACCESS_TOKEN,
)
);
I want to implement the same functionality as an middleware and make it available for all the routes in Slim 4, but I couldn't find any relevant method in the documentation.
Slim 4 supports Regular expression matching for the route placeholders.
Example: