PHP code example of odino / exphpress

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

    

odino / exphpress example snippets

 php


$app = Exphpress\app();

$app->listen(function($req, $res){
    $date = new \DateTime();
    
    $res->setContent("Today is " . $date->format('l, jS \o\f F Y'));
});
 php


$app = Exphpress\app();

$app->get("/call-me-maybe/{name}", function($req, $res){
    $res->setContent("Hey, I just matched you, and this is crazy...");
});
 php
$app->uses(function($req, $res, $next){
    if ($todayIsABadDay) {
        $res->setStatusCode(403);
        $res->setContent(null);
    } else {
        $next();
    }
});