Skip to content

Modules

Composable PHP

Add the parts your app needs, exactly when it needs them.

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.

install
$ leaf install auth db mail
$ leaf install cors cache queue
modules wire into the Leaf ecosystem

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:

bash
composer require leafs/<module>

If you're using Leaf CLI, you can install official Leaf modules without the leafs/ prefix:

bash
leaf install <module>

You can also install multiple modules at once:

bash
leaf install auth db mail
01 / Leaf workflowLeaf CLIBest for Leaf projects. Short names work for first-party modules, and the command keeps the workflow consistent.
02 / PHP workflowComposerBest when you want the raw PHP package manager flow or are installing modules outside a Leaf app.

Using Modules

Most modules integrate directly into Leaf's functional style, so you can use focused helpers without building your own wiring layer.

php
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

01 / FoundationProduct basicsAuth, sessions, cookies, validation, CSRF, CORS, request, and response helpers.
02 / StorageData and stateDatabase, Redis, cache, queues, files, sitemaps, and storage integrations.
03 / InterfaceFrontend and viewsBlade, BareUI, Inertia, Vite, frontend asset builds, and view rendering.
04 / OperationsProduction featuresMail, billing, testing, logging, encryption, and deployment helpers.

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.Introduced in Leaf 5

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:

bash
leaf context

The 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.

ProjectStatusDescription
alchemyLatest Stable Version Total DownloadsTests, code style, refactoring, static analysis + CI for any PHP app, from one config
anchorLatest Stable Version Total DownloadsBuilt-in protection for your Leaf apps
authLatest Stable Version Total DownloadsSimple but powerful authentication system for your apps
bareuiLatest Stable Version Total DownloadsDead simple templating engine with no compilation
billingLatest Stable Version Total DownloadsSubscriptions and one-time payments, one API across providers
bladeLatest Stable Version Total DownloadsLaravel blade port for leaf
cacheLatest Stable Version Total DownloadsCache results of expensive operations
cookieLatest Stable Version Total DownloadsCookie management for your PHP apps
corsLatest Stable Version Total DownloadsCORS operations made simple
csrfLatest Stable Version Total DownloadsCSRF protection for your Leaf apps
dateLatest Stable Version Total DownloadsDead simple PHP dates
dbLatest Stable Version Total DownloadsLightweight query builder for your PHP apps
exceptionLatest Stable Version Total DownloadsCrash reports with stack traces, user journeys and AI handoff
fetchLatest Stable Version Total DownloadsHTTP requests made simple
formLatest Stable Version Total DownloadsForm processes and validation
fsLatest Stable Version Total DownloadsAwesome filesystem operations + file uploads
httpLatest Stable Version Total DownloadsHttp operations made simple (request, response, ...)
inertiaLatest Stable Version Total DownloadsLeaf adapter for inertia JS
lingoLatest Stable Version Total DownloadsMulti-language (i18n) support for your apps
loggerLatest Stable Version Total Downloadsleaf logger module
mailLatest Stable Version Total DownloadsMailing made easy with leaf
mvc-coreLatest Stable Version Total DownloadsBrain of Leaf MVC
passwordLatest Stable Version Total DownloadsPassword encryption/validation/hashing in one box
paystackLatest Stable Version Total DownloadsBilling with paystack
queueLatest Stable Version Total DownloadsQueue integration for leaf
redisLatest Stable Version Total DownloadsFunctionality for Redis
s3Latest Stable Version Total DownloadsDrop-in aws s3 module for Leaf FS
schemaLatest Stable Version Total DownloadsGit for your database: migrations, seeds and schema files
seedlingLatest Stable Version Total DownloadsLightweight console application framework
sessionLatest Stable Version Total DownloadsPHP sessions made simple
sitemapLatest Stable Version Total DownloadsPHP sitemaps made simple
sproutLatest Stable Version Total DownloadsFast, lightweight and minimal CLI framework for PHP
stripeLatest Stable Version Total DownloadsBilling with Stripe
viteLatest Stable Version Total DownloadsLeaf 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.