Common Tasks

sending a form

nothing to say but a code snippet

<form action="<?php App::linkTo("login"); ?>" method"post">
    <p><input type="text" name="pin" /></p>
    <button type="submit">LOGIN</button>
</form>
// App.php
public static function login(){
    if($_POST["pin"] == "yay"){
        return true;
    }
}

calling a webservice

PLAIN_PHP comes with a small but nice WebService library ("WS").

Does not matter if you want a full REST communication or just a one-liner to fetch a few jsons.

    $ws = new PLAIN_PHP\WS("http://base-url.de");
    $ws->addData("apiToken", "supercrypticalsecurehash");
    $ws->get("/users/2");
    $ws->post("/users/2");
    $ws->delete("/users/2");

    //static shortcut for a get request
    $latestAsaphPosts = PLAIN_PHP\WS::getData("http://asaph.drailing.net/json/2");

add my own folders to the autoloader

For all the folders that were specified in the lib/config/conf.php file in the AUTOLOAD_FOLDERS array, the naming convention is prerequisite: class name = filename. You can also use the * wildcard to add all subfolders