PHP code example of boke0 / skull

1. Go to this page and download the library: Download boke0/skull 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/ */

    

boke0 / skull example snippets




ke0\Skull\Router;

$router=new Router();
$router->get("/foo","hello_get");           //GETメソッド
$router->post("/bar","hello_post");         //POSTメソッド
$router->put("/hoge","hello_put");          //PUTメソッド
$router->delete("/piyo","hello_delete");    //DELETEメソッド


...

$router->any("/spam","hello_any");

...

...

$router->map("/spam","hello_any");

...



ke0\Skull\Router;

$router=new Router();
$router->get("/foo","hello_get");           //GETメソッド
$router->post("/bar","hello_post");         //POSTメソッド
$router->put("/hoge","hello_put");          //PUTメソッド
$router->delete("/piyo","hello_delete");    //DELETEメソッド

$function_name=$router->match($_SERVER["PATH_INFO"]);




ke0\Skull\Router;
use Boke0\Skull\Dispatcher;

$router=new Router();
...
/* ここでルートを定義 */
...
$dispatcher=new Dispatcher($router,$container);