Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of simple PHP application conversion to use
* aip variant of php file
class MyApp
public function __invoke($context)
$output = '<h1>Hello world</h1>';
if (isset($context['_GET']['name'])) {
$name = $context['_GET']['name'];
$output .= "<p>(hello to {$name} too</p>";
$headers = array(
'Content-type', 'text/html; charset=utf-8',
'Content-Length', strlen($output),
return array(200, $headers, $output);
* usual php file
header('Content-type: text/html; charset=utf-8');
echo "<h1>Hello world</h1>";
if (isset($_GET['name'])) {
$name = $_GET['name']
echo "<p>(hello to {$name} too</p>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment