PHPackages                             leafs/aloe - 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. [CLI &amp; Console](/categories/cli)
4. /
5. leafs/aloe

ActiveLibrary[CLI &amp; Console](/categories/cli)

leafs/aloe
==========

Overpowered command line tool for your leaf apps.

4.5.4(7mo ago)518.1k↓34.6%63MITJavaScript

Since Dec 22Pushed 7mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (9)Versions (48)Used By (3)

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

Aloe CLI
========

[](#aloe-cli)

[![Latest Stable Version](https://camo.githubusercontent.com/35ecd2ebaed03e1689be3777e97eecf66efdf7e0709aa6da8c659e467698499c/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f6c6561662f762f737461626c65)](https://packagist.org/packages/leafs/leaf)[![Total Downloads](https://camo.githubusercontent.com/8e27af23f95ffd8c01d20050f9db5ce37bb1763351a662809dea110ab6f033bf/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f6c6561662f646f776e6c6f616473)](https://packagist.org/packages/leafs/leaf)[![License](https://camo.githubusercontent.com/ce9580815f935f2426e77afb21c3c4f399209357785d973c8ae764d853b52b74/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f6c6561662f6c6963656e7365)](https://packagist.org/packages/leafs/leaf)

Aloe is a CLI tool that comes with Leaf API and Leaf MVC v2 upwards. It ties into the Leaf console tool and totally replaces all it's functionality. Aloe exists at the root of your application in the `leaf` script and provides a number of helpful commands that can assist you while you build your application. To view all available commands, you can use the `list` command or call `leaf`.

```
php leaf list
# or
php leaf
```

Every command also includes a "help" screen which displays and describes the command's available arguments and options. To view a help screen, precede the name of the command with help:

```
php leaf help db:migrate
```

Interact (REPL)
---------------

[](#interact-repl)

Aloe comes with aloe-interact which is basically powerful REPL powered by [PSY Shell](https://github.com/bobthecow/psysh). Interact allows you to interact with your app, access variables and methods in your Leaf app, run and rollback migrations, perform database operations and so much more. You can access interact on aloe like this:

```
php leaf interact
```

Writing Commands
----------------

[](#writing-commands)

Aside all the commands provided by aloe, you can also create your own commands and run them through the aloe cli. Aloe CLI allows you to directly generate commands to run in the CLI.

### Generating Commands

[](#generating-commands)

To create a new command, you may use the `g:command` aloe command. This command will create a new command class in the default commands directory.

The default directory for commands in Leaf API and Leaf MVC is `App\Console`, with skeleton, you're free to decide where to place your commands.

```
php leaf g:command SendMail
```

Aloe can also generate namespaced commands directly for you. You don't have to manually set namespaces as done with other CLI tools.

```
php leaf g:command mail:send
```

If you want to, you can even generate the command by it's name instead of it's class. Aloe is smart enough to differentiate them.

```
php leaf g:command shutdown
```

### Command Structure

[](#command-structure)

After generating your command, you should start writing what to execute once the command is called. Aloe smartly generates a command name for you, even if you create the command using the class name, however, if it doesn't match what you need, you can always change it.

With the `mail:send` example above, Aloe wil generate `App\Console\MailSendCommand`, in this file, we'll have something that looks like this:

```
