Skip to content

A PHP helper with a set of feature to run php shell scripts

License

Notifications You must be signed in to change notification settings

andou/shelltools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Shell helper

A simple PHP class for API calls

Installation

Add a dependency on andou/shelltools to your project's composer.json file if you use Composer to manage the dependencies of your project. You have to also add the relative repository.

Here is a minimal example of a composer.json file that just defines a dependency on andou/shelltools:

{
    "require": {
        "andou/shelltools": "*"
    },
    "repositories": [
    {
      "type": "git",
      "url": "https://github.com/andou/shelltools.git"
    }
  ],
}

Usage Examples

You can use andou/shelltools in your project this way. Dont forget to chmod +x your script

$ chmod +x script.php
$ ./script.php -f --option_name=option_value
#!/usr/bin/php
<?php
require_once './vendor/autoload.php';
$shell = Andou\Shelltools\Shell::getInstance();
if ($shell->isCli()):
  $shell->getOptions();
  $shell->getFlags();
  
  //sets foregrund color
  $shell->setFgColor(Andou\Shelltools\Shellcolor::FG_BROWN());

  //outputs and newline
  $shell->ol("How are you?!");


  for ($index = 0; $index < 1000; $index++) {
    $shell->spinnerStep();
  }
else:
  echo "ERROR: this script is callable only from PHPCLI environment.\n";
  exit(1);
endif;
exit(0);

About

A PHP helper with a set of feature to run php shell scripts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages