PHPackages                             00f100/fcphp-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. 00f100/fcphp-command

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

00f100/fcphp-command
====================

Library to manipulate console commands into FcPhp

0.1.0(7y ago)147PHPPHP &gt;=7.2

Since Aug 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/00F100/fcphp-command)[ Packagist](https://packagist.org/packages/00f100/fcphp-command)[ Docs](https://github.com/00f100/fcphp-command)[ RSS](/packages/00f100-fcphp-command/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (6)Versions (2)Used By (0)

FcPhp Command
=============

[](#fcphp-command)

Package to manupulate commands of terminal into FcPhp

[![Build Status](https://camo.githubusercontent.com/d9968011b74b0d5f033a0ee1ca40c41b47038f73961771e424e2d3df611fde68/68747470733a2f2f7472617669732d63692e6f72672f3030463130302f66637068702d636f6d6d616e642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/00F100/fcphp-command) [![codecov](https://camo.githubusercontent.com/1960a05580cf127255ef9d0465967eb62ab588414d68302d9d2c6574aed3fcbb/68747470733a2f2f636f6465636f762e696f2f67682f3030463130302f66637068702d636f6d6d616e642f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/00F100/fcphp-command)

[![PHP Version](https://camo.githubusercontent.com/848c253f4d12df6152e33a9c5c34ebac6a8cbd651e6c928a5732b20d562ceb83/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f3030663130302f66637068702d636f6d6d616e642e737667)](https://packagist.org/packages/00F100/fcphp-command) [![Packagist Version](https://camo.githubusercontent.com/7785cb52e2582f36cd998f27d8eb34f6e1485b7dfb5995dd89df40bb34fddc85/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f3030663130302f66637068702d636f6d6d616e642e737667)](https://packagist.org/packages/00F100/fcphp-command) [![Total Downloads](https://camo.githubusercontent.com/46453dc882a428d02a657c9e824f79343fbc71c91d5cc6e4449953ea2882afac/68747470733a2f2f706f7365722e707567782e6f72672f3030463130302f66637068702d636f6d6d616e642f646f776e6c6f616473)](https://packagist.org/packages/00F100/fcphp-command)

How to install
--------------

[](#how-to-install)

Composer:

```
$ composer require 00f100/fcphp-command
```

or add in composer.json

```
{
    "require": {
        "00f100/fcphp-command": "*"
    }
}
```

How to use
----------

[](#how-to-use)

This package use [FcPhp Security Console](https://github.com/00F100/fcphp-sconsole) to manipulate permissions and [FcPhp Cache](https://github.com/00F100/fcphp-cache) to save commands cache for better performance

```
use FcPhp\SConsole\SCEntity;
use FcPhp\Command\Interfaces\ICEntity;
use FcPhp\Command\Facades\CommandFacade;

// Instance of SCEntity provider from FcPhp Security Console
// or ...
$entity = new SCEntity();

// Custom commands...
$commands = [];

// Composer dir to autoload find "commands.php" into packages and cache into FcPhp Cache
$vendorPathAutoload = 'vendor/*/*/config';

$instance = CommandFacade::getInstance($entity, $commands, $vendorPathAutoload);

// Args from console request
// Example: php index.php package datasource connect -h localhost -u user -p password
$args = [
    'package',
    'datasource',
    'connect',
    '-h',
    'localhost',
    '-u',
    'user',
    '-p',
    'password'
];

// Return instance FcPhp\Command\Interfaces\ICEntity
$match = $this->instance->match($args);

if($match instanceof ICEntity) {
    // Print status code
    echo $match->getStatusCode();

    // Print action
    echo $match->getAction();

    // ...
}
```

### [FcPhp\\Command\\Interfaces\\ICEntity](https://github.com/00F100/fcphp-command/tree/master/src/Interfaces/ICEntity.php)

[](#fcphpcommandinterfacesicentity)

```
