PHP Classes

aSQL CLI: Parse and extract a command line arguments string

Recommend this page to a friend!
  Info   Example   Demos   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 177 All time: 8,749 This week: 455Up
Version License PHP version Categories
asql-cli 1.0.16BSD License5.3PHP 5, Console, Parsers
Description 

Author

This class can parse and extract a command line arguments string.

It takes a string with the arguments of a command and it parses it to extract the command options, flags and argument values.

The class returns as result an array with the values of each option, flag, or argument.

It can also rebuild the command line from the array of the parse results, so the command line parameters can be edited and rebuild from the edited parameters array.

Innovation Award
PHP Programming Innovation award nominee
February 2015
Number 7


Prize: One downloadable copy of CodeLobster Professional
Many applications started from a command line shell need a way to parse and extract the command values passed to them.

This class not only can parse command line arguments, but also can rebuild a command line string using previously parsed commands.

This allows implementing a way to edit command lines programmatically but changing the values of a parsed command line and rebuilding the command line string from the changed values.

Manuel Lemos
Picture of Till Wehowski
  Performance   Level  
Name: Till Wehowski <contact>
Classes: 30 packages by
Country: Germany Germany
Age: 45
All time rank: 107269 in Germany Germany
Week rank: 180 Up12 in Germany Germany Up
Innovation award
Innovation award
Nominee: 12x

Example

<?php
error_reporting
(E_ALL);

$dir_lib = __DIR__. DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR;

$file = $dir_lib.'frdl' .DIRECTORY_SEPARATOR.'aSQL'.DIRECTORY_SEPARATOR. 'Engines'.DIRECTORY_SEPARATOR.'Terminal'.DIRECTORY_SEPARATOR.'CLI.php';

$testfile = $dir_lib.'frdl' .DIRECTORY_SEPARATOR.'aSQL'.DIRECTORY_SEPARATOR. 'Engines'.DIRECTORY_SEPARATOR.'Terminal'.DIRECTORY_SEPARATOR.'Test.php';

require
$file;
require
$testfile;

$Terminal = new frdl\aSQL\Engines\Terminal\Test();


  Files folder image Files (16)  
File Role Description
Files folder imageCommand (9 files)
Files folder imagelib (1 directory)
Accessible without login Plain text file CLI.php Class Base class
Accessible without login Plain text file Console.php Example Example implementation
Accessible without login Plain text file example.php Example Example
Accessible without login Plain text file LICENSE.md Lic. License
Accessible without login Plain text file Test.php Example Example

  Files folder image Files (16)  /  Command  
File Role Description
  Accessible without login Plain text file CMD.php Example Example Command Class
  Accessible without login Plain text file cnf.php Example Example script
  Accessible without login Plain text file frdl.php Example Example script
  Accessible without login Plain text file html.php Example Example script
  Accessible without login Plain text file install.php Example Example script
  Accessible without login Plain text file logout.php Example Example script
  Accessible without login Plain text file pm.php Example Example script
  Accessible without login Plain text file setup.php Example Example script
  Accessible without login Plain text file utest.php Example Example script

  Files folder image Files (16)  /  lib  
File Role Description
Files folder imagefrdl (1 directory)

  Files folder image Files (16)  /  lib  /  frdl  
File Role Description
Files folder imageaSQL (1 directory)

  Files folder image Files (16)  /  lib  /  frdl  /  aSQL  
File Role Description
Files folder imageEngines (1 directory)

  Files folder image Files (16)  /  lib  /  frdl  /  aSQL  /  Engines  
File Role Description
Files folder imageTerminal (2 files)

  Files folder image Files (16)  /  lib  /  frdl  /  aSQL  /  Engines  /  Terminal  
File Role Description
  Accessible without login Plain text file CLI.php Class abstract base class
  Accessible without login Plain text file Test.php Class Test

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 75%
Total:177
This week:0
All time:8,749
This week:455Up