PHP code example of taviroquai / duality-demo
1. Go to this page and download the library: Download taviroquai/duality-demo 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/ */
taviroquai / duality-demo example snippets
// Include local configuration
$config = array(
'server' => array(
'url' => '/duality-demo',
'hostname' => 'localhost'
)
);
// Load dependencies
omGlobals($_SERVER, $_REQUEST);
// Validate HTTP request
if (!$request) die('HTTP request not found!');
// Set request
$server->setRequest($request);
// Define default route
$app->call('server')->setHome(function(&$req, &$res) {
// Tell response what is the output
$res->setContent('Hello World!');
});
// Finaly, tell server to start listening
$app->call('server')->listen();