https://github.com/00f100/fcphp-command
Library to manipulate Console Command into FcPhp
https://github.com/00f100/fcphp-command
command console fcphp php7 php72
Last synced: 4 months ago
JSON representation
Library to manipulate Console Command into FcPhp
- Host: GitHub
- URL: https://github.com/00f100/fcphp-command
- Owner: 00F100
- License: mit
- Created: 2018-07-31T02:19:05.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-12T21:08:58.000Z (almost 7 years ago)
- Last Synced: 2025-01-19T21:49:34.274Z (6 months ago)
- Topics: command, console, fcphp, php7, php72
- Language: PHP
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FcPhp Command
Package to manupulate commands of terminal into FcPhp
[](https://travis-ci.org/00F100/fcphp-command) [](https://codecov.io/gh/00F100/fcphp-command)
[](https://packagist.org/packages/00F100/fcphp-command) [](https://packagist.org/packages/00F100/fcphp-command) [](https://packagist.org/packages/00F100/fcphp-command)
## How to install
Composer:
```sh
$ composer require 00f100/fcphp-command
```or add in composer.json
```json
{
"require": {
"00f100/fcphp-command": "*"
}
}
```## 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
```php
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)
```php