Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MonishAMPT/fastroute-code/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
FastRoute makes it easy to build RESTful APIs by supporting all HTTP methods and allowing you to define multiple routes for the same URI with different methods.CRUD Operations
Here’s an example of implementing CRUD operations for an API resource:Handler Functions
Each route references a handler function that processes the request:Complete REST API Example
Here’s a complete example showing a RESTful API implementation:routes/api.php
Content Type Headers
For API routes, set the appropriate content type header:index.php
Route Groups
Organize related API routes using groups:Best Practices
Use HTTP Methods
Use appropriate HTTP methods (GET, POST, PUT, DELETE) for different operations
JSON Responses
Always return JSON responses for API endpoints
Group Related Routes
Use route groups to organize related endpoints
Handle Input
Parse request body using
file_get_contents('php://input')Next Steps
Dynamic Parameters
Add dynamic parameters to your routes
HTTP Methods
Learn about all available HTTP methods