Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.25 KB

File metadata and controls

34 lines (25 loc) · 1.25 KB

Your First Leaf App

Hello World

First of all, we need to setup our .htaccess file. See Re-routing to index.

To create a hello world project with Leaf, you simply need to initialise Leaf. This will spin up Leaf's core packages. Amongst the core packages is Leaf's router. This simply takes all requests coming into the application and handles them based on rules you define. Enough talk, let's get dirty.

// import composer's autoloader
require_once __DIR__ . "/vendor/autoload.php";

// initialise leaf
$leaf = new Leaf\App();

$leaf->get('/', function() {
	echo "Hello World";
});

$leaf->run();

That's all. It's this simple.

This is a very basic example, if you want to explore deeper, more useful examples, you can check out our code labs section



Request Response Routing Environment Using a database


Built with ❤ by Mychi Darko