It seems that there are many PHP frameworks that require RESTful design patterns.
I am looking for a framework that does a very good job, providing a reliable solution to these three elements (or their equivalence).
1. Resource Requests
The first thing to do is to process the URL to resolve the resources.
/path/to/resource = controller.action()
2. Request Methods
Secondly, you need to handle various types of query methods.
GET /path/to/resource = controller.get() POST /path/to/resource = controller.post()
Perhaps with a rollback from the universal handler if the request method does not exist.
GET /path/to/resource = controller.action() PUT /path/to/resource = controller.action() POST /path/to/resource = controller.action()
3. Answer formats
Finally, I saw people attaching formats to the end of a URL to help the framework know what type of response is expected.
/path/to/resource.html /path/to/resource.json
Other ways to pass the response file in the header or as a URI parameter ( ?format=json ).
These are the three elements that need to be covered. However, they do not need to be processed in the same way as I just showed - these are just examples.
source share