Skip to content

Start building with Leaf โ€‹

Leaf is a PHP framework designed to stay light, while giving you production-ready pieces to handle all the heavy-lifting as soon as you need them. We rebuilt the Leaf experience with AI in mind, so you and your agents can build at the speed of thought hehe

Here is the smallest possible Leaf app:

php
<?php

require __DIR__ . '/vendor/autoload.php';

app()->get('/', fn () => response()->json([
  'message' => 'Hello World!'
]));

app()->run();

And when you need more, install only what the project needs:

Leaf CLIrecommended
Composerplain PHP workflow

In short, Leaf provides a streamlined development experience with all the essential tools ready to go.

01 / Request flowRouting and middlewareClean endpoints, groups, dynamic routes, and request flow without framework noise.
02 / ProtectionAuth, sessions, and securityLogin, signup, JWT, CSRF, headers, encryption, and protected routes are ready when you are.
03 / DataDatabase toolsUse the query builder, models, Redis, files, validation, and migrations around your own app shape.
04 / AI contextAgent-friendly contextLeaf keeps conventions visible so prompts become implementation, not a guessing game.
Technical Requirements

Before you start with Leaf, verify that your system has the following installed:

  • PHP v8.2 or higher
  • Composer for package management
  • Leaf CLI optional, but recommended for easier app management

If you don't have PHP and Composer installed, here are some easy options to get you set up:

  • Laravel Herd gives Mac and Windows developers a quick local PHP environment.
  • php.new installs PHP and Composer on Windows, Linux, and Mac with one command.
  • Xampp is the traditional cross-platform web server package.

Choose your path