dev-master
9999999-dev https://github.com/neverender/sneezeA simple php 5.4+ router
MIT
The Requires
- php >=5.4.0
by Nicholas Bernardi
microframework router
Wallogit.com
2017 © Pedro Peláez
A simple php 5.4+ router
Sneeze is a simple php router., (*1)
It uses 5.4+ features such as closure object binding and short array syntax., (*2)
php >= 5.4.0, (*3)
Use Composer, (*4)
Instantiate Sneeze application:, (*5)
$app = new \Sneeze\Sneeze;
Define an HTTP GET route:, (*6)
$app->get('/hello/:name', function($name) {
echo "hello $name";
});
Run it:, (*7)
$app->run();
You can also define PUT, POST and DELETE HTTP routes. Since modern browsers don't support PUT and DELETE, you can fake it by doing a POST request and adding a "_METHOD" parameter like so:, (*8)
<form action="/put/route/1" method="post">
<input type="hidden" name="_METHOD" value="PUT"/>
<!-- other stuff -->
</form>
Inside routes, you have access to $this->request, which is an associative array of the usual request variables including 'get', 'post', 'uri', 'method', 'body', etc., (*9)
A simple php 5.4+ router
MIT
microframework router