Download the PHP package netson/l4shell without Composer

On this page you can find all versions of the php package netson/l4shell. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package l4shell

L4shell: Shell Commands for Laravel 4

This laravel 4 package is a simple wrapper class for shell commands (exec). It allows you to add exec() commands to your application without losing the ability to write unit tests. The package comes with a Facade, so using Mockery for testing purposes is a breeze.

This package will not work on Windows systems.

Installation

Simply use composer:

Or add the requirement to the composer.json file manually:

After the package has been successfully loaded, you have to add it to the Service Providers array:

An alias is automatically registered by the Service Provider, but in case you're wondering, this is it:

Usage

This package escapes both the entire command (using escapeshellcmd()) and each individual argument (using escapdeshellarg()). Almost all methods allow object chaining for easy setup.

Initializing a new command:

This can be done via the shortcut registered in the Service Provider:

or by creating a new object manually:

Using the get() method will initialize an empty command object and requires you to use the setCommand() and setArguments() method (optional) before the command can be executed.

Sample command: without arguments

If the command was executed successfully, the output of the command will be returned. If the command could not be executed, an exception will be thrown, including the error message from the command (except when using the sendToDevNull() method; see below).

Sample command: with arguments

When adding arguments, make sure you add the correct number of placeholder (sprintf-format), otherwise an Exception will be thrown.

By default, any existing arguments are replaced when you call the setArguments() method to avoid stacking up arguments over a series of sequential commands. However, if you would like to add them in several steps, you can do so by passing a second (optional) boolean parameter to the method:

If you would like to manually clear any existing arguments, use the following method:

Sample command: send output to /dev/null

The package has an easy way of sending output from commands to /dev/null since quite often you may only be interested in the exit status, and not the output text. Sending output to /dev/null will render any output messages useless, but the exit code will off course still be available and exceptions will be thrown when errors occur.

Sample command: enable logging of all commands

L4shell allows you to easily log all calls to shell commands to the default laravel log. By default, logging is enabled. Logging uses the default Laravel 4 logging package (Monolog).

For each successful command, 3 or 4 log lines will appear, depending on whether arguments have been set:

To disable logging, publish the package config file:

And then change the option in the file.

Alternatively, you can change the logging settings at runtime:

Setting and unsetting the execution path

In case you wish to execute your command from within a particular directory, you can use the following method:

The execution path is a static variable, which in this case means that the execution path, if set only once, will affect ALL commands executed thereafter.

NOTE: The execution path is changed right before executing the command, and is changed back to the original setting right after the command has been executed. This way you don't have to remember to revert the working directory and it won't mess up any other scripts running after this one.

If you wish to unset the execution path, simply call the method without any parameters:

Setting and unsetting the executable path

In case the folder containing your executables is not in the path of the user executing the command, you can use the following method:

This will effectively change your command from simply to . This is also a static variable, meaning that the setting will persist across commands.

If you wish to unset the executable path (for example to run a command from a local directory), simply call the method without any parameters:

Prevent certain characters from being escaped

When you have a specific shell command which requires the use of characters that would normally be escaped by the or functions, you can use the method. This method accepts an array of characters that will not be escaped by L4shell:

SINCE THIS METHOD COMPLETELY CIRCUMVENTS THE ESCAPING OF POTENTIALLY DANGEROUS CHARACTERS, USE THIS METHOD WITH THE UTMOST CAUTION!!

Unit testing

Unit testing your modules/packages when using L4shell is easy. Simply use Mockery style calls in your tests:

For more information on unit testing with laravel 4, check out the following docs:


All versions of l4shell with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
illuminate/support Version 4.0.x
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package netson/l4shell contains the following files

Loading the files please wait ....