Skip to content

Latest commit

 

History

History
76 lines (55 loc) · 2.33 KB

README.md

File metadata and controls

76 lines (55 loc) · 2.33 KB

awesome-cli

Packagist Downloads GitHub code size in bytes Codecov CodeFactor Build Status GitHub issues GitHub pull requests Gitmoji

How to install

To install the package use the command below

composer require awesome-packages/awesome-cli

How to use

Add script in composer.json:

"scripts": {
    "awesome-cli": "./vendor/bin/awesome-cli"
}

Create your command class:

<?php

namespace AwesomePackages\AwesomeCliTests\Mock;

use AwesomePackages\AwesomeCli\AwesomeCommand;

final class SayHelloWorldCommand extends AwesomeCommand
{
    protected string $group = 'say';
    protected string $action = 'hello-world';
    protected string $description = 'This is a simple description';

    public static function handle(): string
    {
        return 'Hello World';
    }
}

Create commands.php file in src/config folder:

<?php

\AwesomePackages\AwesomeCli\CommandRunner::registerCommand([
    \AwesomePackages\AwesomeCliTests\Mock\SayHelloWorldCommand::class,
    ... // More commands
]);

The folder structure will look like this:

src
|_ commands
   |_ SayHelloWorldCommand.php
|_ config
   |_ commands.php

Finally, run the command below:

composer awesome-cli say:hello-world

License

MIT © AwesomeCli