PHP

Enable CORS in PHP

HTTP headers in PHP to allow CORS access

header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
header("Allow: GET, POST, OPTIONS, PUT, DELETE");
$method = $_SERVER['REQUEST_METHOD'];
if($method == "OPTIONS") {
    die();
}

Mustache templates

Implements Mustache templates in PHP files. Install vendor from Composer and config the FilesystemLoader option, and change the file extensoin from .mustache to .html; Create and put the templates on folder /views and the partials on /views/partials. [ read ]