PHPackages                             ilyaotinov/command - 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. ilyaotinov/command

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

ilyaotinov/command
==================

Library for make and run CLI commands

v1.1.2(3y ago)116MITPHP

Since Aug 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ilya372317/command)[ Packagist](https://packagist.org/packages/ilyaotinov/command)[ RSS](/packages/ilyaotinov-command/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (13)Used By (0)

Simple CLI command library.
===========================

[](#simple-cli-command-library)

Description:
------------

[](#description)

Library for execute php code by command line. Can parse input argument and options and write data to Output stream.

Installation:
-------------

[](#installation)

```
composer require ilyaotinov/command

```

Configuration:
--------------

[](#configuration)

### Run script:

[](#run-script)

```
../base-app-path/vendor/bin/xaduken

```

and you will see message like this: `You need fill config file. Check it on path: /path/you-project/config/command.yaml`

Library create for you directory and sample config file. It will be contained this data:

```
#---
#commands:
    #  TestCommand:
        #    class: App\AbstractCommand\TestCommand
        #    name: test-command
        #    description: write your commands and put information about them there
        #...

```

You need to register your own command like in this example.

### TestCommand:

[](#testcommand)

it`s not important setting, you may pass here everything you want.

### class:

[](#class)

Fully clarified class name. Used for create command class instance.

### name:

[](#name)

Name of command. Used in console for execute command.

### description:

[](#description-1)

Description of command. You can use {help} argument to retrive itDescription of command. You can use {help} argument to retrieve it.

Usage:
------

[](#usage)

### Create your own command:

[](#create-your-own-command)

1. Create command class
2. Extend it from Ilyaotinov\\CLI\\AbstractCommand
3. Define handle method.
4. Register your command in ./config/command.yaml file

And that`s it, you can use you command with ./vendor/bin/xaduken script

### Command class example:

[](#command-class-example)

```
