PHP Classes

PHP Executable Script Generator: Generate shell scripts that can execute PHP code

Recommend this page to a friend!
  Info   View files Documentation   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2022-06-24 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 84 This week: 3All time: 9,822 This week: 62Up
Version License PHP version Categories
php_component_cli_en 1.0.0GNU Lesser Genera...5PHP 5, Unix, Console, Code Generation
Description Author

This package can generate shell scripts that can execute PHP code.

It provides a PHP script that you can execute from a command-line shell to generate a new PHP script file with a given name.

The generated script checks different directories to find the autoload.php script file.

Then it calls the class provided with this package to check the current CLI environment.

Developers can edit the generated script to write their script custom login code.

Innovation Award
PHP Programming Innovation award nominee
June 2022
Nominee
Vote
PHP can help run command tools that can perform specific actions.

Many PHP developers are used to managing their projects using commands run from a command-line console shell.

This package can generate a shell script with PJP code that developers can edit to add their custom command tool logic to the hand.

This way, this package simplifies the creation of new console shell script commands written in PHP.

Manuel Lemos
Picture of nvb
  Performance   Level  
Name: nvb <contact>
Classes: 20 packages by
Country: Germany Germany
Innovation award
Innovation award
Nominee: 12x

Details

Command Line Environment for PHP

This project aims to deliver an free as in freedom, easy to use and lean as in fat free environment to create executable command line php files.

This project does not want to be competitive to a big console environment like the once mentioned below in the link section.

The versioneye status is: Dependency Status

The current change log can be found here.

Take a look on openhub.net.

Usage

Create Executable Command Line File

./bin/net_bazzline_create_executable_command_line_file bin/hello

Write Your Code

#open bin/hello
#replace line "$usage			= basename(__FILE__) . ' [-v|--verbose]';" with the line below
$usage			= basename(__FILE__) . ' <your name> [-v|--verbose]';
#replace the line "//put in your business logic" with the code below
//begin of dependencies
$arguments  = $environment->getArguments();
$values     = $arguments->getValues();
//end of dependencies

//begin of argument validation
$valuesNotAreValid = (count($values) == 0);

if ($valuesNotAreValid) {
    throw new InvalidArgumentException(
        'invalid number of arguments provided'
    );
}
//end of argument validation

//begin of business logic
$name = ucfirst($values[0]);

$environment->outputIfVerbosityIsEnabled('provided values are: ' . implode(' ', $values));
$environment->output('Hello ' . $name);
//end of business logic

#execute ./bin/hello world

Example

Install

By Hand

mkdir -p vendor/net_bazzline/php_component_cli_environment
cd vendor/net_bazzline/php_component_cli_environment
git clone https://github.com/bazzline/php_component_cli_environment .

With Packagist

composer require net_bazzline/php_component_cli_environment:dev-master

API

API is available at bazzline.net.

Links

  Files folder image Files  
File Role Description
Files folder imagebin (1 file)
Files folder imageexample (1 file)
Files folder imagesource (1 file)
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  bin  
File Role Description
  Accessible without login Plain text file net_bazzline_creat...e_command_line_file Aux. Script that generates the new script code

  Files folder image Files  /  example  
File Role Description
  Accessible without login Plain text file hello Output Example output script

  Files folder image Files  /  source  
File Role Description
  Plain text file CommandLineEnvironment.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:84
This week:3
All time:9,822
This week:62Up
For more information send a message to info at phpclasses dot org.