2017 © Pedro Peláez
 

library command

Command Framework

image

corex/command

Command Framework

  • Saturday, November 4, 2017
  • by corex
  • Repository
  • 0 Watchers
  • 0 Stars
  • 61 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 23 Versions
  • 2 % Grown

The README.md

CoRex Command

Command Framework for php., (*1)

License Build Status codecov, (*2)

You will recognize some familiar patterns i.e. signature from Laravel but with additional properties. This is for future use in other frameworks and CMS'es., (*3)

Run "php crcmd" to see list of available commands., (*4)

Run "php crcmd help make:shortcut" to create a shortcut in current directory. This file can be modified to suit your needs i.e. disabling internal commands. If you specify --command, you will be able to make a shortcut for a specific command., (*5)

Every command created must end in "Command.php" i.e. "MyCommand.php". Otherwise it will not be added to list of available commands., (*6)

Installation

  • Run "composer require corex/command".

Commands (internal).

  • make:command - This command creates commands.
  • make:shortcut - This command creates a shortcut in current directory.
  • json:delete - Delete key.
  • json:get - Get key.
  • json:set - Set key in json.

Documentation for command

Look at existing commands to see example. Source can be found in vendor package., (*7)

Properties

$component

Every command belongs to a component. This property specifies the name of component. Must be specified in lowercase. This can be set to an empty string and will then be a "main"-command (no component)., (*8)

$signature

This signature describes the arguments and options of the command. It follows the same setup as Laravel 5., (*9)

Format is "command {argument/--option : description} {argument/--option : description}" - Part 1 "command" is the name of the command. Must be specified in lowercase. - Part 2 "{argument/--option : description}" is the format of arguments and options. Can be specified multiple times. Each argument/options must be surrounded by {}. - Every argument is required unless you add a "?" at the end of argument-name. If "?" is added, argument will return null. - Every option must be prefix'ed with "--". If specified on command-line, it will be true, otherwise false. If you need to parse a value instead, add a "=" at the end., (*10)

$description

This is a short description you will see on the list of available commands., (*11)

$visible

This option can be either true or false. If false, it will not be visible on the list of commands. You can still use "help" to show command and it will still work., (*12)

You code lives in a method called run()., (*13)

Helpers when developing

If you use "$this->" when developing, there will be a long list of methods to help you write commands i.e. table(), header(), info(), throwError(), words(), choice(), etc., (*14)

Start

To start a new project using commands, do following: - Install package. - Setup namespace for commands. - Use "make:shortcut" to create a shortcut in root of your project. - Modify and set registerOnPath(). - Use "make:command" to create a new commmand and modify it., (*15)

Config

Setup configuration for your project., (*16)

Setup config-path. Default is {root}/config., (*17)

Use $this->config('path.to.my.config'). Uses dot-notation. First section is the file itself. Rest is array., (*18)

Example: If you have following config-file config/vars.php with following array in it...., (*19)

return [
    'test' => [
        'example' => 'testing'
    ]
];

.... and you write ...., (*20)

$myVar = $this->config('vars.test.example');

.... you will get "testing"., (*21)

The Versions

04/11 2017

dev-develop

dev-develop

Command Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

command console

04/11 2017

dev-master

9999999-dev

Command Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

command console

04/11 2017

2.1.2

2.1.2.0

Command Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

command console

02/09 2017

2.1.1

2.1.1.0

Command Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

command console

08/07 2017

2.1.0

2.1.0.0

Command Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

command console

08/07 2017

2.0.2

2.0.2.0

Command Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

command console

19/06 2017

2.0.1

2.0.1.0

Command Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

command console

18/06 2017

2.0.0

2.0.0.0

Command Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

command console

10/12 2016

1.4.2

1.4.2.0

Command Framework for php

  Sources   Download

MIT

The Requires

 

command console

26/11 2016

1.4.1

1.4.1.0

Command Framework for php

  Sources   Download

MIT

The Requires

 

command console

26/11 2016

1.4.0

1.4.0.0

Command Framework for php

  Sources   Download

MIT

The Requires

 

command console

11/11 2016

1.3.3

1.3.3.0

Command Framework for php

  Sources   Download

MIT

The Requires

 

command console

07/11 2016

1.3.2

1.3.2.0

Command Framework for php

  Sources   Download

MIT

The Requires

 

command console

26/10 2016

1.3.1

1.3.1.0

Command Framework for php

  Sources   Download

MIT

The Requires

 

command console

26/10 2016

1.3.0

1.3.0.0

Command Framework for php

  Sources   Download

MIT

The Requires

 

command console

09/10 2016

1.2.5

1.2.5.0

Command Framework for php

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

command console

18/09 2016

1.2.4

1.2.4.0

Command Framework for php

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

command console

18/09 2016

1.2.3

1.2.3.0

Command Framework for php

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

command console

18/09 2016

1.2.2

1.2.2.0

Command Framework for php

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

command console

14/09 2016

1.2.1

1.2.1.0

Command Framework for php

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

command console

14/09 2016

1.2.0

1.2.0.0

Command Framework for php

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

command console

14/09 2016

1.1.0

1.1.0.0

Command Framework for php

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

command console

05/09 2016

1.0.0

1.0.0.0

Command Framework for php

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

command console