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.
Installation
Get FastRoute up and running in your project in just a few minutes.Requirements
FastRoute requires PHP 5.4.0 or higher. For best performance, use PHP 7.4 or later.
Installing with Composer
Ensure Composer is Installed
Make sure you have Composer installed on your system. Verify by running:If Composer is not installed, follow the official installation guide.
Create composer.json
In your project root directory, create a
composer.json file with the FastRoute dependency:composer.json
Install Dependencies
Run Composer to install FastRoute and its dependencies:This will create a
vendor directory containing FastRoute and Composer’s autoloader.Project Structure
For better organization, we recommend structuring your project like this:Separating routes into different files (API and web) makes your application more maintainable and easier to scale.
Web Server Configuration
FastRoute requires URL rewriting to route all requests through your main PHP file.Apache Configuration
Create an.htaccess file in your project root:
.htaccess
Nginx Configuration
Add this to your Nginx server block:Verification
To verify the installation, create a simple test in yourindex.php:
index.php