-
Notifications
You must be signed in to change notification settings - Fork 0
Hello World!
John Aldrich Bernardo edited this page Feb 12, 2018
·
2 revisions
Make sure to have your copy of calf.
<?php
require("vendor/autoload.php");
$app = new \Calf\App();
$home = new \Calf\HTTP\Route('/', function($req, $res) {
return $res->write('Hello World!');
});
$app->add($home);
$app->run();In order to work, Calf is using Web Servers URL rewriting engine so you'll need to configure one.
Don't know how to configure one? Click .htaccess.
Here is a basic sample configuration:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]Test your Hello World application using PHPs built-in Web Server.
php -S localhost:8888 index.php
Visit localhost:8888 in your favorite browser and see your application Up and Running.
The calf is open-sourced software licensed under the MIT license.