# πŸ’» Leaf CLI v1.0

# πŸ“‚ Installation

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

composer global require leafs/cli ^1.0
1

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
1

# πŸ“• Usage Guide

# 🚧 Creating projects

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

leaf create <project-name>
1

This will generate a new Leaf PHP app in the <project-name> directory. You can also create Leaf API and Leaf MVC (opens new window) apps from the cli.

Leaf API:

leaf create <project-name> --api
1

or

leaf create <project-name> -a
1

Leaf MVC:

leaf create <project-name> --mvc
1

or

leaf create <project-name> -m
1

# βž• Installing packages

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

leaf install leafs/ui
1

# 🧿 Interactive Shell

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

$ leaf app:interact
...
>>> $user = new User;
...
>>> $user->name = "Mychi";
...
>>> $user->save();
1
2
3
4
5
6
7

# πŸ“Ί Previewing your app

This opens up your app on the PHP local server.

leaf app:serve
1

You can also specify the port

leaf app:serve -p 8000
1

Full

Leaf CLI 1.0.0

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  create        Create a new Leaf PHP project
  help          Displays help for a command
  install       Add a new package to your leaf app
  list          Lists commands
 app
  app:interact  Interact with your application
  app:serve     Run your Leaf app
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22