Skip to content

Start building with Leaf

Get started

A full PHP app in about a minute.

Leaf gives you the clean starting point first: routing, structure, helpers, and a project shape that stays readable for you, your team, and your AI tools.

terminal
$ composer global require leafs/cli -W
$ leaf create my-app
$ cd my-app
$ leaf serve

Open http://localhost:5500 and you have a running app. No setup maze, no ceremony.

Why it matters

Small surface area

Start with the parts you need. Add auth, database, queues, mail, and more when the app asks for them.

AI-readable by default

Routes, modules, and app conventions stay obvious, so assistants can generate code that fits your project.

Still just PHP

No hidden runtime or lock-in. Deploy anywhere PHP runs.

Everything you need, nothing you don't

Leaf is designed to stay light while giving you production-ready pieces as soon as you need them.

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.

Here is the smallest possible Leaf app:

php
<?php

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

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

app()->run();

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

Leaf CLI

leaf install <package-name>

Composer

composer require leafs/<package-name>

Tell your AI assistant to "build out authentication" and it can follow Leaf's structure instead of inventing one.

Technical Requirements

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

  • PHP v7.4 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