1. Go to this page and download the library: Download idno/torophp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
idno / torophp example snippets
class HelloHandler {
function get() {
echo "Hello, world";
}
}
Toro::serve(array(
"/" => "HelloHandler",
));
class ProductHandler {
function get($name) {
echo "You want to see product: $name";
}
}
class ExampleHandler {
function get() {}
function post() {}
function get_xhr() {}
function post_xhr() {}
}
// Fired for 404 errors; must be defined before Toro::serve() call
ToroHook::add("404", function() {});
// Before/After callbacks in order
ToroHook::add("before_request", function() {});
ToroHook::add("before_handler", function() {});
ToroHook::add("after_handler", function() {});
ToroHook::add("after_request", function() {});
class SomeHandler {
function __construct() {
ToroHook::add("before_handler", function() { echo "Before"; });
ToroHook::add("after_handler", function() { echo "After"; });
}
function get() {
echo "I am some handler.";
}
}
sh
$ curl -s https://getcomposer.org/installer > installer.php
$ less installer.php
$ # When you're certain it's safe...
$ php installer.php