remysd / simple-router
A simple router to match with your url's
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/remysd/simple-router
This package is auto-updated.
Last update: 2025-11-29 03:11:24 UTC
README
Installation
composer require remysd/simple-router
Example
require './vendor/autoload.php'; use RemySd\SimpleRouter\Router; $router = new Router(); $router->setBasePath('/simple-router'); $router->addRoute('/articles', 'article', 'all', 'article_all'); $router->addRoute('/articles/{id}', 'article', 'show', 'article_single'); $properties = $router->match($_SERVER['REQUEST_URI']); $url = $router->generate('single_article', ['id' => 3]);
Requirements
Minimun configuration required in .htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]