Modules
Composable PHP
Modules are independent pieces of Leaf functionality. They stay small, framework-agnostic, easy to install, and ready to use in Leaf apps, Leaf MVC projects, or even plain PHP projects.
Why modules
Start small
Use the core framework first, then add capabilities as your product grows.
Stay explicit
Installed modules make your app's capabilities obvious to people and AI tools.
Avoid lock-in
Most modules are regular Composer packages that fit normal PHP workflows.
Installing Modules
Modules are Composer packages, so you can install them with Composer:
composer require leafs/<module>If you're using Leaf CLI, you can install official Leaf modules without the leafs/ prefix:
leaf install <module>You can also install multiple modules at once:
leaf install auth db mailUsing Modules
Most modules integrate directly into Leaf's functional style, so you can use focused helpers without building your own wiring layer.
auth()->login($credentials);
db()->select('users')->where('id', 1)->first();
response()->json(['ok' => true]);In Leaf MVC, modules can also work through config files, controllers, models, services, and other structured app pieces.
Common Module Groups
Modules and AI Context NewInstalled modules stay visible to agentsLeaf keeps module capabilities in shared project context and can produce a compact handoff for external assistants.
Modules make your app easier for assistants to understand because installed packages and their configuration are recorded in .leaf/CONTEXT.md. Agents inside the project read that shared memory alongside the filesystem and keep it aligned as the app changes.
If you are sharing the app with an external assistant that cannot access the folder, generate a compact handoff after adding modules:
leaf contextThe command prints a minified view of the shared context, including installed modules, app structure, routes, and conventions. Paste that output into the external assistant so it can use what your app already has instead of inventing new patterns.
List of Modules
We update this list regularly. If you have a module you'd like to see here, feel free to open an issue or create a pull request on our documentation repository. Community-created modules are welcome too.
| Project | Status | Description |
|---|---|---|
| alchemy | Tests, code style, refactoring, static analysis + CI for any PHP app, from one config | |
| anchor | Built-in protection for your Leaf apps | |
| auth | Simple but powerful authentication system for your apps | |
| bareui | Dead simple templating engine with no compilation | |
| billing | Subscriptions and one-time payments, one API across providers | |
| blade | Laravel blade port for leaf | |
| cache | Cache results of expensive operations | |
| cookie | Cookie management for your PHP apps | |
| cors | CORS operations made simple | |
| csrf | CSRF protection for your Leaf apps | |
| date | Dead simple PHP dates | |
| db | Lightweight query builder for your PHP apps | |
| exception | Crash reports with stack traces, user journeys and AI handoff | |
| fetch | HTTP requests made simple | |
| form | Form processes and validation | |
| fs | Awesome filesystem operations + file uploads | |
| http | Http operations made simple (request, response, ...) | |
| inertia | Leaf adapter for inertia JS | |
| lingo | Multi-language (i18n) support for your apps | |
| logger | leaf logger module | |
| Mailing made easy with leaf | ||
| mvc-core | Brain of Leaf MVC | |
| password | Password encryption/validation/hashing in one box | |
| paystack | Billing with paystack | |
| queue | Queue integration for leaf | |
| redis | Functionality for Redis | |
| s3 | Drop-in aws s3 module for Leaf FS | |
| schema | Git for your database: migrations, seeds and schema files | |
| seedling | Lightweight console application framework | |
| session | PHP sessions made simple | |
| sitemap | PHP sitemaps made simple | |
| sprout | Fast, lightweight and minimal CLI framework for PHP | |
| stripe | Billing with Stripe | |
| vite | Leaf server component for Vite |
Community Modules
Modules created by the Leaf community are welcome here. They're not officially maintained by the Leaf team, but we're happy to list them. Built something? Open an issue or send a pull request on the documentation repository to add yours.
