1
0
mirror of https://github.com/dannyvankooten/AltoRouter.git synced 2025-07-10 03:16:28 +02:00
Files
php-altorouter/index.html
Danny van Kooten b1c7b26248 increase font sizes
2023-10-09 20:10:37 +02:00

57 lines
2.1 KiB
HTML

---
title: AltoRouter - PHP Router that supports REST, dynamic and reversed routing
layout: default
---
<h1>AltoRouter</h1>
<p class="intro">AltoRouter is a small but powerful routing class for PHP 5.3+, heavily inspired by <a href="https://github.com/chriso/klein.php/">klein.php</a>.</p>
{% highlight php startinline %}
$router = new AltoRouter();
// map homepage
$router->map( 'GET', '/', function() {
require __DIR__ . '/views/home.php';
});
// map users details page
$router->map( 'GET|POST', '/users/[i:id]/', function( $id ) {
$user = .....
require __DIR__ . '/views/user/details.php';
});
{% endhighlight %}
<h2>Router Features</h2>
<ul>
<li>HTTP methods</li>
<li>Dynamic routing with (named) route parameters</li>
<li>Flexible regular expression routing, inspired by <a href="http://www.sinatrarb.com/">Sinatra</a></li>
<li>Reversed routing</li>
<li>Custom regexes</li>
</ul>
<h2 id="using-altorouter">Using AltoRouter</h2>
<p>To use AltoRouter in your project you need a web server running PHP 5.3 or newer.</p>
<ul>
<li><a href="{{ '/usage/install.html' | relative_url }}">Install AltoRouter</a></li>
<li><a href="{{ '/usage/rewrite-requests.html' | relative_url }}">Rewrite all requests to AltoRouter</a></li>
<li><a href="{{ '/usage/mapping-routes.html' | relative_url }}">Map your routes</a></li>
<li><a href="{{ '/usage/matching-requests.html' | relative_url }}">Match requests</a></li>
<li><a href="{{ '/usage/processing-requests.html' | relative_url }}">Process the request your preferred way</a></li>
</ul>
<h2>
<a name="contributors" class="anchor" href="#contributors"><span class="octicon octicon-link"></span></a>Contributors</h2>
<ul>
<li><a href="https://github.com/dannyvankooten">Danny van Kooten</a></li>
<li><a href="https://github.com/koenpunt">Koen Punt</a></li>
<li><a href="https://github.com/adduc">John Long</a></li>
<li><a href="https://github.com/niahoo">Niahoo Osef</a></li>
</ul>
<p>Released under the <a href="{{ '/license.html' | relative_url }}">MIT Public License</a>.</p>
<p>&copy; 2012-2023 <a href="https://dannyvankooten.com/">Danny van Kooten</a></p>