Skip to content

Start simple. Ship fast. ​

A working PHP app before the idea gets cold.

Start with routing and HTTP helpers, then add only what the product asks for. The project stays readable to you, your team, and your AI tools from the first file.

terminal
$ leaf create my-app --lite
$ cd my-app
$ leaf serve

You begin with

One clear entry pointNo directory tour before you can respond to a request.
Routing and HTTPThe essentials for pages, APIs, webhooks, and small tools.
A path to growInstall modules or move into MVC without changing ecosystems.

Open http://localhost:5500. Your app is live.

The smallest useful Leaf app ​

A lite project starts with enough structure to handle real requests without putting a framework ceremony between you and the product.

php
<?php

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

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

app()->run();
01 / RouteMatch the requestConnect an HTTP method and URL to the behavior your application needs.
02 / LogicWrite the useful partKeep the first version close to the request, then extract structure as complexity earns it.
03 / ResponseReturn clean outputSend JSON, HTML, redirects, downloads, or any response the client expects.

Build with an assistant that knows the app ​

This app was created with Leaf CLI, so .leaf/CONTEXT.md is already available as shared project memory. A local agent reads it alongside the filesystem and syncs useful changes back when it finishes. No context command is required.

If you are using an external assistant that cannot access the folder, print a compact project handoff:

bash
leaf context

Your prompt

Add a Stripe webhook, validate the event, and store successful payments.

Local agent: shared context and filesystem access stay in sync. External assistant: paste the output of leaf context so it receives the compact project map.

AI sees

entry: lite
routes: known
modules: known
patterns: Leaf

The goal is not more generated code. It is fewer invented patterns and changes that fit the application you already have.

Add capabilities when the product asks ​

Leaf modules add focused features without replacing your starting point.

bash
leaf install auth db mail

Once installed, modules use the same concise Leaf style:

php
auth()->login($credentials);

$user = db()
    ->select('users')
    ->where('email', $email)
    ->first();

mailer()
    ->to($user->email)
    ->send('welcome');

Grow at your own pace ​

You do not need to predict the final architecture on day one. Choose the amount of structure the product needs now.

01 / LiteProve the ideaUse a small entry point for scripts, experiments, webhooks, APIs, and focused tools.
02 / ModulesAdd capabilitiesBring in authentication, data, mail, billing, queues, or caching as requirements appear.
03 / MVCOrganize the productMove into controllers, models, views, services, and conventions when the team or app needs them.

All three stages stay inside Leaf, so growth does not require a framework rewrite.

Deploy anywhere PHP runs ​

Leaf has no private runtime or hosting lock-in. Deploy to a VPS, shared hosting, containers, or a managed PHP platform using the same application you built locally.

When structure becomes useful

The same project can grow into Leaf MVC.Keep the ecosystem, add the application map.
Continue to MVC

Choose the part of the stack your next feature needs.