PHPackages                             leafs/cli - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. leafs/cli

ActiveLibrary[Database &amp; ORM](/categories/database)

leafs/cli
=========

A simple command line tool for installing and interacting with your leaf apps

v4.6.0(6mo ago)149.0k↓23.8%5[1 issues](https://github.com/leafsphp/cli/issues)MITTypeScript

Since Jul 7Pushed 6mo agoCompare

[ Source](https://github.com/leafsphp/cli)[ Packagist](https://packagist.org/packages/leafs/cli)[ Docs](https://cli.leafphp.dev)[ GitHub Sponsors](https://github.com/leafsphp)[ Fund](https://opencollective.com/leaf)[ RSS](/packages/leafs-cli/feed)WikiDiscussions v4.x Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (58)Used By (0)

 [![](https://camo.githubusercontent.com/d98ee5e32c2ff016fdfdac6c42654a908f4cc34b229c7b00caacc5a717455ae8/68747470733a2f2f6c6561667068702e6465762f6c6f676f2d636972636c652e706e67)](https://camo.githubusercontent.com/d98ee5e32c2ff016fdfdac6c42654a908f4cc34b229c7b00caacc5a717455ae8/68747470733a2f2f6c6561667068702e6465762f6c6f676f2d636972636c652e706e67)

Leaf CLI 2
==========

[](#leaf-cli-2)

 [![Latest Stable Version](https://camo.githubusercontent.com/94e4a8a8e60ad2a3dffd253156a61a48a52a36e12ef73464016ae96966f72a61/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f636c692f762f737461626c65)](https://packagist.org/packages/leafs/cli) [![Total Downloads](https://camo.githubusercontent.com/6d92b75f76a869ad18ae11d3185d4f253d16d9e168c22cefdcf81bcf63fffa12/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f636c692f646f776e6c6f616473)](https://packagist.org/packages/leafs/cli) [![License](https://camo.githubusercontent.com/50c219fba2056c63682c1c74572158c5db0e7c19c38c4537f375a6b8ef212e80/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f636c692f6c6963656e7365)](https://packagist.org/packages/leafs/cli)

A simple command line tool for creating and interacting with your leaf projects. You can do stuff like installing packages, interacting with your app, previewing your app, ...

Installation
------------

[](#installation)

You can get this tool up and running on your system using composer:

```
composer global require leafs/cli
```

Make sure to place Composer's system-wide vendor bin directory in your `$PATH` so the leaf executable can be located by your system. This directory exists in different locations based on your operating system; however, some common locations include:

- Windows: `%USERPROFILE%\AppData\Roaming\Composer\vendor\bin`
- macOS: `$HOME/.composer/vendor/bin`
- GNU / Linux Distributions: `$HOME/.config/composer/vendor/bin` or `$HOME/.composer/vendor/bin`

You could also find the composer's global installation path by running `composer global about` and looking up from the first line.

Eg (Adding composer bin to path linux):

```
export PATH=$PATH:$HOME/.config/composer/vendor/bin
```

Eg (Adding composer bin to path mac):

```
export PATH=$PATH:$HOME/.composer/vendor/bin
echo $PATH
```

Usage Guide
-----------

[](#usage-guide)

### Creating projects

[](#creating-projects)

To start a new project, simply open up your console or terminal in your directory for projects and enter:

With leaf 3:

```
leaf create
```

This will now prompt you to select a preset

```
Creating a new Leaf app "" in ./projects-directory.

* Please pick a preset
  [0] leaf
  [1] leaf mvc
  [2] leaf api
 >
```

Selecting a number will generate a leaf app based on the associated preset. As you can see, there are 3 presets:

- **Leaf**: a bare leaf 3 project
- **Leaf MVC**: a leaf MVC project with leaf 3
- **Leaf API**: a leaf API project with leaf 3

You can also pick a preset directly without going through the interactive installer.

**Leaf:**

```
leaf create  --basic
```

**Leaf API:**

```
leaf create  --api
```

**Leaf MVC:**

```
leaf create  --mvc
```

You can also add `--custom` for a fully customisable leaf project.

```
leaf create  --custom
```

### Installing packages

[](#installing-packages)

This cli tool also adds a feature to install modules from composer

```
leaf install ui
```

This installs the `leafs/ui` package.

You can also install third party packages from packagist

```
leaf install psr/log
```

### Interactive Shell

[](#interactive-shell)

You can also use the interactive shell to interact with your app.

```
$ leaf interact
...
>>> $user = new User;
...
>>> $user->name = "Mychi";
...
>>> $user->save();
```

### Previewing your app

[](#previewing-your-app)

This opens up your app on the PHP local server.

```
leaf serve
```

You can also specify the port

```
leaf serve -p 8000
```

In v2.1, you can also start the leaf server with hot module watching. This reloads your application anytime a change is made to your application code. To get started, simply start the leaf server with the `--watch` flag.

```
leaf serve --port 8000 --watch
```

License
-------

[](#license)

Leaf CLI is open-sourced software licensed under the [MIT license](LICENSE.md).

😇 Contributing
--------------

[](#-contributing)

We are glad to have you. All contributions are welcome! To get started, familiarize yourself with our [contribution guide](https://leafphp.dev/community/contributing.html) and you'll be ready to make your first pull request 🚀.

To report a security vulnerability, you can reach out to [@mychidarko](https://twitter.com/mychidarko) or [@leafphp](https://twitter.com/leafphp) on twitter. We will coordinate the fix and eventually commit the solution in this project.

### Code contributors

[](#code-contributors)

   [ ![](https://avatars.githubusercontent.com/u/26604242?v=4)
  **Michael Darko**  ](https://github.com/mychidarko)   [ ![](https://avatars.githubusercontent.com/u/5151307?v=4)
  **tedtop**  ](https://github.com/tedtop)  Sponsoring Leaf
---------------

[](#sponsoring-leaf)

Your cash contributions go a long way to help us make Leaf even better for you. You can sponsor Leaf and any of our packages on [open collective](https://opencollective.com/leaf) or check the [contribution page](https://leafphp.dev/support/) for a list of ways to contribute.

And to all our existing cash/code contributors, we love you all ❤️

### Cash contributors

[](#cash-contributors)

You can view all sponsors @

🤯 Links/Projects
----------------

[](#-linksprojects)

- [Leaf Docs](https://leafphp.dev)
- [Leaf MVC](https://mvc.leafphp.dev)
- [Leaf API](https://api.leafphp.dev)
- [Leaf CLI](https://cli.leafphp.dev)
- [Aloe CLI](https://leafphp.dev/aloe-cli/)

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance64

Regular maintenance activity

Popularity33

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 97.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~34 days

Recently: every ~25 days

Total

57

Last Release

207d ago

Major Versions

v1.0.0 → v2.02021-10-13

v2.15 → v3.x-dev2025-02-10

v3.x-dev → v4.0-beta2025-02-28

v2.16 → v4.0-RC2025-03-07

v2.x-dev → v4.0.12025-03-26

PHP version history (2 changes)v1.0.0PHP ^7.2

v2.0.3PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29547806?v=4)[Mychi](/maintainers/Mychi)[@mychi](https://github.com/mychi)

---

Top Contributors

[![mychidarko](https://avatars.githubusercontent.com/u/26604242?v=4)](https://github.com/mychidarko "mychidarko (296 commits)")[![Medoo48](https://avatars.githubusercontent.com/u/122442342?v=4)](https://github.com/Medoo48 "Medoo48 (4 commits)")[![crosa7](https://avatars.githubusercontent.com/u/32076460?v=4)](https://github.com/crosa7 "crosa7 (2 commits)")[![tedtop](https://avatars.githubusercontent.com/u/5151307?v=4)](https://github.com/tedtop "tedtop (1 commits)")

---

Tags

clileafphpphpphpdatabaseserverinstallerdeployleaf

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/leafs-cli/health.svg)

```
[![Health](https://phpackages.com/badges/leafs-cli/health.svg)](https://phpackages.com/packages/leafs-cli)
```

###  Alternatives

[matthew-p/docker-server

Universal docker server, Nginx, PHP-FPM, MySql, Redis

112.8k](/packages/matthew-p-docker-server)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)[sarfraznawaz2005/backupmanager

laravel package to backup/restore files and database.

313.7k](/packages/sarfraznawaz2005-backupmanager)[modul-is/orm

Lightweight hybrid ORM/Explorer

1118.1k](/packages/modul-is-orm)[jonas-elias/hyperf-oracle

A oracle handler for hyperf/database.

102.0k](/packages/jonas-elias-hyperf-oracle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
