-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
Muhammet Şafak edited this page Jun 9, 2026
·
1 revision
- PHP 8.1 or later
- A PSR-7 HTTP message implementation
- A PSR-7 emitter (to send the response to the client)
composer require initphp/routerThe router does not ship a PSR-7 implementation — bring your own. The wiki uses InitPHP HTTP:
composer require initphp/httpRoute every request through a single index.php so the router can match any
path.
Apache — public/.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]NGINX:
location / {
try_files $uri $uri/ /index.php?$query_string;
}- A PSR-11 container (
psr/container) if you want the router to resolve controllers/services from your container — see Dependency Injection.
Next: Quick Start.
initphp/router · MIT License · part of the InitPHP family
Source · Issues · Discussions · Packagist · Contributing · Security Policy
Getting Started
Defining Routes
Handling Requests
Reference
Migration