Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the way Laravel handles routing, with both simplicity and expand-ability in mind.
I've added a new method suitable for preflight requests in JavaScript to solve a problem I encountered. I needed to accept the OPTIONS method, but I didn't want to use something similar to:
This would return a status code of 200 also if the route doesn't exist. So I present to you SimpleRouter::fetch. This method accepts the GET, POST and OPTIONS methods, but in the case of the OPTIONS method, it will not call your callback and will return an empty page.
I've added a new method suitable for preflight requests in JavaScript to solve a problem I encountered. I needed to accept the
OPTIONS
method, but I didn't want to use something similar to:This would return a status code of 200 also if the route doesn't exist. So I present to you
SimpleRouter::fetch
. This method accepts theGET
,POST
andOPTIONS
methods, but in the case of theOPTIONS
method, it will not call your callback and will return an empty page.