Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-12T21:08:58.000Z (over 6 years ago)
- Last Synced: 2024-11-18T02:26:41.297Z (about 2 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
[![Build Status](https://travis-ci.org/00F100/fcphp-command.svg?branch=master)](https://travis-ci.org/00F100/fcphp-command) [![codecov](https://codecov.io/gh/00F100/fcphp-command/branch/master/graph/badge.svg)](https://codecov.io/gh/00F100/fcphp-command)
[![PHP Version](https://img.shields.io/packagist/php-v/00f100/fcphp-command.svg)](https://packagist.org/packages/00F100/fcphp-command) [![Packagist Version](https://img.shields.io/packagist/v/00f100/fcphp-command.svg)](https://packagist.org/packages/00F100/fcphp-command) [![Total Downloads](https://poser.pugx.org/00F100/fcphp-command/downloads)](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