Skip to content
Leaf 5 · A new era

Build products at
the speed of thought

Leaf is the lightweight PHP framework for shipping real products. Pull in auth, billing, queues and 25+ other modules only when your app needs them. Your AI tools get real project context to work with, and the code stays clean, readable, and more importantly yours.

Terminal

Open Source

Backed by the community

Leaf is fully community-backed. Your support keeps the momentum going as we make modern PHP faster, cleaner, and more AI-ready.

AI-native framework

Give your agent the context your PHP app deserves.

Leaf makes your routes, modules, structure, conventions, and project state readable to AI, so assistants can build inside your app instead of guessing around it.

You readapp/controllers/OrdersController.php
public function store() {
  $data = request()->validate([
    'items'  => 'array|required',
    'coupon' => 'optional|string',
  ]);

  $order = Order::create($data);
  billing()->charge($order);

  return response()->json($order);
}
Your agent reads.leaf/context.md
# my-product
stack     leaf 5 · mvc · sqlite · react/inertia
modules   auth, db, billing, queue

## conventions
routes       → app/routes/*.php
controllers  → app/controllers, one per resource
validation   → request()->validate() first

## recent
+ OrdersController::store  charges on create

01 · Context

Agents get the map

Routes, modules and conventions are written down where a model looks first.

02 · Patterns

One pattern to learn

Every module shares the same fluent shape, so generated code lands where you'd put it.

03 · Sync

Context moves both ways

Useful changes get written back, so the next session starts informed.

Where Leaf sits

Bigger than a router. Smaller than a kitchen sink.

You start with routing and a request object. Everything else is a module you install when the product needs it, not a layer you inherit on day one. That's what keeps the app small enough to hold in your head, and in a context window.

Micro-frameworks

Routing and a request object. Auth, db and billing become a package hunt and a weekend.

Leaf

Start with app(). Add auth(), db(), billing() as the product grows. Same fluent shape on every module, so there's one pattern to learn.

authdbbillingqueuemailcachecorssessionformfetchredisstorage+13

Full-stack frameworks

Everything included, whether you use it or not. Powerful, and a lot to hold in mind before feature one.

Architecture

Your code stays structured. No matter how you build.

Leaf keeps your app consistent, readable, and easy for AI to reason about from day one, so every feature, change, and iteration fits naturally into your codebase.

Pattern language

Consistent by default

Every module in Leaf follows the same API patterns. Routes, controllers, models, and services all use familiar patterns, so you don't have to learn a different way for each part.

php
auth()->login([...]);
db()->select(...)->where([...]);
cache()->get('key');
response()->json([...]);

Same fluent, chainable pattern across everything. This predictability is what makes tools and AI work better with your code.

Frontend

Your stack stays yours

Use any frontend you want. Your AI assistant still gets the same backend map. Your tools follow your stack. Learn more ↗

Leaf routeapp/routes/menu.php
app()->get('/menu/items', function() {
  $items = db()->select('menu_items')
    ->all();

  return response()->inertia('menu', [
    'items' => $items
  ]);
});
React viewapp/views/js/menu.jsx
const Menu = ({ items }) => (
  <div className="menu-grid">
    {items.map((item) => (
      <MenuCard key={item.id}
        item={item} />
    ))}
  </div>
);

export default Menu;
Rendered by React

Veggie Loaded Burger

Vegan · 4 stars

$8.99

Southern Fried Chicken

Spicy · 5 stars

$9.49

Healthy Beef Burger

Low-carb · 4 stars

$8.99

Ecosystem

One team. A whole toolchain.

Leaf is more than the framework. We're a family of focused tools that work anywhere PHP (or JavaScript) runs, each with its own home.

Community

Join other people building real products

Build alongside developers shaping how modern products are made. Share what you're building, get help when you're stuck, and compare the ways people are building with AI in real Leaf apps.

The Leaf Discord is where releases drop first, questions get answered, and builders show off what they're shipping, from weekend projects to production apps.

Start building with us
Leaf Community

Building in public

Ideas behind the way we build

How we think about frameworks, AI-assisted development, and shipping products that last.

Speak at an event

Invite us to your next event

Want a Leaf core team member to speak? We'd love to bring practical Leaf 5 and AI-native PHP demos to your attendees.

Any format

Conferences, meetups, workshops, Twitter Spaces. We're flexible.

AI-native demos

Live coding on real Leaf 5 apps, including the agent workflow people keep asking about.

Free of charge

We speak for free. Just cover travel if it's in-person.

Contributors

Wall of Fame

These contributors make Leaf cleaner, faster, and easier for humans and AI tools to understand.

Deploys by Netlify

Get notes on Leaf 5, AI-native PHP, and product-building in your inbox. You can also read our blog posts at blog.leafphp.dev. You may also go social at Twitter, join our discussions, or watch our videos on YouTube.