For php 5.2+
Because web.py is just so helpful for those quick python projects, why not share the love with PHP?
It is simple enough to grok quickly, with just enough features to get you going. The only magic is that header request methods are mapped by web.php to your classes methods. Unlike web.py, web.php includes an AJAX compatible method.
For a more complete example, please checkout current version from SVN.
<?php
// sample program
require 'init.php';
$urls = array(
'#^$#' => 'hello',
'#^named/(?P<namedparam>[a-zA-Z_]+)/?$#' => 'named'
);
class hello {
function GET($p)
{
echo 'Welcome to web-php';
}
function POST($p)
{
// like you just posted a form
echo 'request via POST';
}
function AJAX($p)
{
echo "requested via AJAX";
}
}
class named {
function GET($p)
{
var_dump($p);
echo "this is a captured var from the URI: ".$p['namedparam'];
}
}
Web::run($urls);
