๐ŸŽฎ A simple command line tool for installing and interacting with your leaf apps

Overview




Leaf CLI 2

Latest Stable Version Total Downloads License



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

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

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 <project-name> --v3

With leaf 2:

leaf create <project-name> --v2

If no version is passed in, leaf CLI will prompt you to select a version to use in your leaf app.

leaf create <project-name>
* Select a version to use 
  [0] v3
  [1] v2
 >

This will now prompt you to select a preset

Creating a new Leaf app "<project-name>" in ./projects-directory.

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

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

  • Leaf: a bare leaf project
  • Leaf MVC: a leaf MVC project with leaf 2
  • Leaf API: a leaf API project with leaf 2
  • Skeleton: a leaf skeleton project

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

Leaf:

leaf create <project-name> --basic

Leaf API:

leaf create <project-name> --api

Leaf MVC:

leaf create <project-name> --mvc

Leaf Skeleton:

leaf create <project-name> --skeleton

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

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

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

Leaf CLI is open-sourced software licensed under the MIT license.

๐Ÿ˜‡ Contributing

We are glad to have you. All contributions are welcome! To get started, familiarize yourself with our contribution guide and you'll be ready to make your first pull request ๐Ÿš€ .

To report a security vulnerability, you can reach out to @mychidarko or @leafphp on twitter. We will coordinate the fix and eventually commit the solution in this project.

Code contributors


Michael Darko

tedtop

๐Ÿคฉ 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 or check the contribution page for a list of ways to contribute.

And to all our existing cash/code contributors, we love you all โค๏ธ

Cash contributors


Aaron Smith

Peter Bogner

Vano

Casprine

Farhan Yahaya

Lucas Chaplain

๐Ÿคฏ Links/Projects

You might also like...
A fluent interface for interacting with Netopia's services.
A fluent interface for interacting with Netopia's services.

laravel-netopia A fluent interface for interacting with Netopia's services. Info Database It'll create a table named netopia_payments with the followi

Demo of symfony/console features to build rich command line utilities

Symfony Console Demo This project is a demonstration of symfony/console features. To run the project with Docker. With bash: docker build -t myconsole

TrovCMS command line installer.

Trov CMS Installer TrovCMS is a start kit for websites, built on Filament and Laravel. This install allows you to quickly spin up new sites to hit the

Rugby schedules on the command-line

Rugby Schedule Rugby Schedule is a command-line tool that keeps you up to date with rugby tournament schedules. Install Requires PHP 8.0 or later Via

Command line of the website.
Command line of the website.

Deutsch English Svenska Command 0.8.42 Command line of the website. How to use the command line Open a terminal window. Go to your installation folder

A collection of command-line utilities to aid in debugging browser engines.

Browser debug utilities This project contains several scripts that make the process of debugging browser engines much easier (some special cases excep

Dispatcher is a Laravel artisan command scheduling tool used to schedule artisan commands within your project so you don't need to touch your crontab when deploying.
Dispatcher is a Laravel artisan command scheduling tool used to schedule artisan commands within your project so you don't need to touch your crontab when deploying.

Dispatcher Dispatcher allows you to schedule your artisan commands within your Laravel project, eliminating the need to touch the crontab when deployi

PHP_Depend is an adaptation of the established Java development tool JDepend. This tool shows you the quality of your design in terms of extensibility, reusability and maintainability.

PHP Depend Documentation PHP Depend for enterprise Available as part of the Tidelift Subscription. The maintainers of PHP Depend and thousands of othe

Comments
  • Cant run application after leaf cli install because of case sensitivity

    Cant run application after leaf cli install because of case sensitivity

    Hi, I tested the leaf cli v2.0.4 and used the create command: leaf create test --api --v3 First thing i found: Documentation is not correct. leaf app:serve doesnt work anymore, it should be leaf serve.

    The actual error after starting occurs when I try to reach the application:

    > leaf serve
    Leaf development server started: http://localhost:5500
    Happy coding!
    [Thu Feb  3 09:19:43 2022] PHP 8.0.15 Development Server (http://localhost:5500) started
    Leaf development server started: http://localhost:5500
    Happy coding!
    [Thu Feb  3 09:19:46 2022] 127.0.0.1:33078 Accepted
    [Thu Feb  3 09:19:46 2022] PHP Warning:  require(/home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/../../../../Config/app.php): Failed to open stream: No such file or directory in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php on line 10
    [Thu Feb  3 09:19:46 2022] PHP Fatal error:  Uncaught Error: Failed opening required '/home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/../../../../Config/app.php' (include_path='.:/usr/share/php') in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php:10
    Stack trace:
    #0 /home/shens/workspaces/lyssar/applications/test/public/index.php(61): AppConfig()
    #1 /home/shens/workspaces/lyssar/applications/test/index.php(24): require_once('...')
    #2 {main}
      thrown in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php on line 10
    [Thu Feb  3 09:19:46 2022] 127.0.0.1:33078 [500]: GET / - Uncaught Error: Failed opening required '/home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/../../../../Config/app.php' (include_path='.:/usr/share/php') in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php:10
    Stack trace:
    #0 /home/shens/workspaces/lyssar/applications/test/public/index.php(61): AppConfig()
    #1 /home/shens/workspaces/lyssar/applications/test/index.php(24): require_once('...')
    #2 {main}
      thrown in /home/shens/workspaces/lyssar/applications/test/vendor/leafs/mvc-core/src/config.php on line 10
    Leaf development server started: http://localhost:5500
    Happy coding!
    

    Folder structure

    > ls -al
    insgesamt 212
    drwxrwxr-x  9 shens shens   4096 Feb  3 09:17 .
    drwxrwxr-x  9 shens shens   4096 Feb  3 09:17 ..
    drwxrwxr-x  9 shens shens   4096 Dez 16 10:00 app
    -rw-rw-r--  1 shens shens   2123 Dez 16 10:00 composer.json
    -rw-rw-r--  1 shens shens 142245 Feb  3 09:17 composer.lock
    drwxrwxr-x  2 shens shens   4096 Dez 16 10:00 config
    -rw-rw-r--  1 shens shens    220 Dez 16 10:00 .editorconfig
    -rw-rw-r--  1 shens shens    624 Feb  3 09:17 .env
    -rw-rw-r--  1 shens shens    624 Dez 16 10:00 .env.example
    drwxrwxr-x  2 shens shens   4096 Dez 16 10:00 .github
    -rw-rw-r--  1 shens shens     66 Dez 16 10:00 .gitignore
    -rw-rw-r--  1 shens shens    593 Dez 16 10:00 .htaccess
    -rw-rw-r--  1 shens shens    672 Dez 16 10:00 index.php
    -rw-rw-r--  1 shens shens   2513 Dez 16 10:00 leaf
    drwxrwxr-x  2 shens shens   4096 Dez 16 10:00 lib
    drwxrwxr-x  2 shens shens   4096 Dez 16 10:00 public
    -rw-rw-r--  1 shens shens    295 Dez 16 10:00 README.MD
    drwxrwxr-x  5 shens shens   4096 Dez 16 10:00 storage
    drwxrwxr-x 17 shens shens   4096 Feb  3 09:17 vendor
    

    as you can see: All folders are created lowercase, the application tries to find CamelCase folder names instead.

    opened by lyssar 11
  • Install leafs/cli on nvm

    Install leafs/cli on nvm

    I use nvm to manage the versions of Node, with this configuration I cannot install leafs/cli globally on the version of node I am using with Composer already installed.

    Are there any solutions?

    Thanks

    opened by fonnets 4
  • Support of PHP 8.x

    Support of PHP 8.x

    At the moment you can't install the leaf cli with php8.0. There are some constraint which are conflicting:

    > php -v
    PHP 8.0.14 (cli) (built: Dec 20 2021 21:22:57) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v4.0.14, Copyright (c) Zend Technologies
        with Zend OPcache v8.0.14, Copyright (c), by Zend Technologies
    
    > composer global require leafs/cli:^2.0
    Changed current directory to /home/shens/.config/composer
    ./composer.json has been updated
    Running composer update leafs/cli
    Loading composer repositories with package information
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - leafs/cli[v2.0, ..., v2.0.2] require php ^7.2 -> your php version (8.0.14) does not satisfy that requirement.
        - leafs/cli[v2.0.3, ..., v2.0.4] require symfony/console ^5.0 -> found symfony/console[v5.0.0, ..., v5.4.3] but the package is fixed to v4.4.30 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
        - Root composer.json requires leafs/cli ^2.0 -> satisfiable by leafs/cli[v2.0, ..., v2.0.4].
    
    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
    
    Installation failed, reverting ./composer.json and ./composer.lock to their original content.
    
    

    Active support ended 28 Nov 2021 | 2 months ago And security updates will end on 28 Nov 2022 | in 9 month

    Do you have any plans to upgrade to PHP8.0?

    opened by lyssar 3
  • leafcli not installing

    leafcli not installing

    Discussed in https://github.com/orgs/leafsphp/discussions/143

    Originally posted by vimkaf September 8, 2022 Good day house, I am having some composer troubles when installing leafcli

    Command composer global require leafs/cli

    Error Problem 1 - Root composer.json requires leafs/cli ^2.4 -> satisfiable by leafs/cli[v2.4.0, v2.4.1, v2.4.2]. - leafs/cli[v2.4.0, ..., v2.4.2] require psy/psysh ^0.11.1 -> found psy/psysh[v0.11.1, ..., v0.11.8] but the package is fixed to v0.10.12 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions. You can also try re-running composer require with an explicit version constraint, e.g. "composer require leafs/cli:*" to figure out if any version is installable, or "composer require leafs/cli:^2.1" if you know which you need.

    opened by mychidarko 1
Releases(2.6.0)
  • 2.6.0(Oct 8, 2022)

  • 2.5.0(Sep 9, 2022)

    2.5.0 - 9 Sep 2022

    Added

    • Added --phpunit option
    • Added --pestphp option

    Changed

    • Updated create command UI

    Removed

    • Removed --with-tests option
    Source code(tar.gz)
    Source code(zip)
  • v2.4.3(Sep 8, 2022)

  • v2.4.2(Sep 7, 2022)

  • v2.4.1(Sep 6, 2022)

  • v2.4.0(Sep 6, 2022)

  • v2.3.0(Aug 5, 2022)

    v2.3.0 - 5 August 2022

    Added

    • Added optional test setup with alchemy to create command
    • Added test command to quickly run tests with alchemy
    • Added test:setup command
    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Jul 18, 2022)

  • v2.1.0(Jun 16, 2022)

  • v2.0.11(May 29, 2022)

  • v2.0.10(May 3, 2022)

  • v2.0.9(Apr 30, 2022)

  • v2.0.8(Apr 18, 2022)

  • v2.0.7(Feb 23, 2022)

    v2.0.7 - 23rd February 2022

    Added

    • Added uninstall command
    • Added ascii art

    Fixed

    • Fixed install command bug
    • Updated app:serve text to serve

    Changed

    • Internal refactors for performance and modularity
    Source code(tar.gz)
    Source code(zip)
  • v2.0.6(Feb 13, 2022)

  • v2.0.5(Feb 12, 2022)

    v2.0.5 - 12th February 2022

    Added

    Added support for project root install

    You can now run the install command without any packages if you are in your project directory. Running install without any dependencies will look for a composer.json and install all the dependencies from them. If there's no composer.lock file in the current directory, leaf CLI uses the composer update command under the hood.

    This addition gives Leaf CLI the feel of the npm CLI.

    Added @ for version scoping

    Leaf CLI now allows you to scope packages to a particular version using @.

    leaf install [email protected]
    

    The above command will install leaf db v1.0.

    Added support for package chaining

    You can now add a bunch of packages to install as done with composer, npm and other CLIs as well.

    leaf install db illuminate/support 
    

    Using this method, you can even add specific versions of some packages like this:

    leaf install db illuminate/[email protected] nesbot/carbon
    

    Fixed

    • Updated serve message
    Source code(tar.gz)
    Source code(zip)
  • v2.0.4(Dec 9, 2021)

    v2.0.4 - 9th December 2021

    Added

    • Added PHP 8 support
    • Added skeleton, leaf 2, and leaf 3 themes for a quick install
    • Added leaf 3 support for app creation
    • Added interactive preset installer
    • Added interactive version picker
    • Added auto-update on create
    • Added update command
    • Added package class
    • Added version tags in composer.json
    • Added support for Leaf MVC 3
    • Added support for Leaf API 3
    • Added support for Skeleton 3

    Fixed

    • Fixed server port bug

    Changed

    • Restructured leaf CLI
    • Upgraded dependencies
    • Smart install command for packages & modules
    • Restructured app:interact command
    • Switched to internal composer for app creation
    • Removed command namespaces

    Removed

    • Removed Leaf blade component
    • Removed unused dependencies
    Source code(tar.gz)
    Source code(zip)
  • v2.0.3(Nov 15, 2021)

    v2.0.3 - 15th November 2021

    Added

    • Added PHP 8 support
    • Added skeleton, leaf 2, and leaf 3 themes for a quick install
    • Added leaf 3 support for app creation
    • Added interactive installer
    • Added auto-update on create
    • Added update command
    • Added package class
    • Added version tags in composer.json
    • Added support for Leaf MVC 3
    • Added support for Leaf API 3
    • Added support for Skeleton 3

    Fixed

    • Fixed server port bug

    Changed

    • Restructured leaf CLI
    • Upgraded dependencies
    • Limited install command to modules
    • Restructured app:interact command
    • Switched to internal composer for app creation
    • Removed command namespaces

    Removed

    • Removed Leaf blade component
    • Removed unused dependencies
    Source code(tar.gz)
    Source code(zip)
  • v2.0.2(Oct 13, 2021)

    v2.0.2 - 13th October 2021

    Added

    • Added skeleton, leaf 2, and leaf 3 themes for a quick install
    • Added leaf 3 support for app creation
    • Added interactive installer
    • Added auto-update on create
    • Added update command
    • Added package class
    • Added version tags in composer.json

    Fixed

    • Fixed server port bug

    Changed

    • Restructured leaf CLI
    • Upgraded dependencies
    • Limited install command to modules
    • Restructured app:interact command
    • Switched to internal composer for app creation

    Removed

    • Removed Leaf blade component
    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Oct 13, 2021)

    v2.0.1 - ๐Ÿ Sugar Maple - 13th October 2021

    Added

    • Added skeleton, leaf 2, and leaf 3 themes for a quick install
    • Added leaf 3 support for app creation
    • Added interactive installer
    • Added auto-update on create
    • Added update command
    • Added package class
    • Added version tags in composer.json

    Fixed

    • Fixed server port bug

    Changed

    • Restructured leaf CLI
    • Upgraded dependencies
    • Limited install command to modules
    • Restructured app:interact command
    • Switched to internal composer for app creation

    Removed

    • Removed Leaf blade component
    Source code(tar.gz)
    Source code(zip)
  • v2.0(Oct 13, 2021)

    v2.0 - ๐Ÿ Sugar Maple - 13th October, 2021

    Added

    • Added skeleton, leaf 2 and leaf 3 themes for quick install
    • Added leaf 3 support for app creation
    • Added interactive installer

    Fixed

    • Fixed server port bug

    Changed

    • Restructured leaf CLI
    • Upgraded dependencies
    • Limited install command to modules
    • Restructured app:interact command
    • Switched to internal composer for app creation

    Removed

    • Removed Leaf blade component
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Jul 7, 2020)

Owner
Leaf Framework
Building tools which help you create clean, simple but powerful web applications and APIs quickly โšก๏ธ
Leaf Framework
A collection of command line scripts for Magento 2 code generation, and a PHP module system for organizing command line scripts.

What is Pestle? Pestle is A PHP Framework for creating and organizing command line programs An experiment in implementing python style module imports

Alan Storm 526 Dec 5, 2022
Allows installing Drupal extensions event if not compatible with installed drupal/core package

mglaman/composer-drupal-lenient Lenient with it, Drupal 10 with it. Why? The Drupal community introduced a lenient Composer facade that modified the d

Matt Glaman 14 Dec 18, 2022
Leaf's very own high-speed, high-performance server

[WIP] Leaf Eien Server Eien is Leaf's implementation of a high-speed, high-performance server based on powerful tools like Open Swoole and Swoole. Eie

Leaf Framework 8 Dec 28, 2022
WARNING! This software is currently non-functional. - A system which makes installing Jexactyl far, far easier.

Jexactyl Assistant A system which makes installing Jexactyl far, far easier. WARNING ?? This software is currently in heavy alpha testing and WILL NOT

Jexactyl 7 Nov 14, 2022
EBook-Apps - The eBook Apps is a web application that helps you browse ebooks from anywhere using your smartphone and laptop.

โšก๏ธ eBook Apps The eBook Apps is a web application that helps you browse ebooks from anywhere using your smartphone and laptop. ?? Getting Started To s

Ahmad Fauzy 32 Nov 14, 2022
The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. All commands are extendable by a module API.

netz98 magerun CLI tools for Magento 2 The n98 magerun cli tools provides some handy tools to work with Magento from command line. Build Status Latest

netz98 758 Dec 28, 2022
m4b-tool is a command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b

m4b-tool m4b-tool is a is a wrapper for ffmpeg and mp4v2 to merge, split or and manipulate audiobook files with chapters. Although m4b-tool is designe

Andreas 798 Jan 8, 2023
Tango is a command-line tool for analyzing access logs ๐Ÿ’ƒ

Tango Tool to get insights from the server access logs Tango is a dependency-free command-line tool for analyzing access logs ?? Currently, work on th

Roman Glushko 94 Nov 22, 2022
A simple package for interacting with the exchangerate.host API

Table of Contents Overview Installation Usage Methods Exchange Rate Getting the Rate Between Two Currencies Getting the Rate Between More Than Two Cur

Ash Allen 23 Feb 16, 2022
PHP library for interacting with the Waves blockchain.

Waves-PHP PHP client library for interacting with Waves blockchain platform. Installation composer require waves/client Usage See example.php for full

Waves Protocol 4 Sep 30, 2022