1
0
mirror of https://github.com/dannyvankooten/AltoRouter.git synced 2025-10-22 19:56:20 +02:00
Files
php-altorouter/index.html
2014-10-07 18:03:27 +02:00

58 lines
2.2 KiB
HTML

---
title: AltoRouter - PHP Router that supports REST, dynamic and reversed routing
layout: default
---
<h1>
<a name="altorouter-" class="anchor" href="#altorouter-"><span class="octicon octicon-link"></span></a>AltoRouter <a href="http://travis-ci.org/dannyvankooten/AltoRouter"><img src="https://api.travis-ci.org/dannyvankooten/AltoRouter.png" alt="Build Status"></a>
</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">Install AltoRouter</a></li>
<li><a href="/usage/rewrite-requests.html">Rewrite all requests to AltoRouter</a></li>
<li><a href="/usage/mapping-routes.html">Map your routes</a></li>
<li><a href="/usage/matching-requests.html">Match requests</a></li>
<li><a href="/usage/processing-requests.html">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">MIT Public License</a>.</p>
<p>&copy; 2012-2014 <a href="https://dannyvankooten.com/">Danny van Kooten</a></p>