Download the PHP package mrrio/shellwrap without Composer
On this page you can find all versions of the php package mrrio/shellwrap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mrrio/shellwrap
More information about mrrio/shellwrap
Files in mrrio/shellwrap
Package shellwrap
Short Description Use any command-line tool as a PHP function.
License MIT
Homepage http://github.com/MrRio/shellwrap
Informations about the package shellwrap
ShellWrap
What is it?
It's a beautiful way to use powerful Linux/Unix tools in PHP. Easily and logically pipe commands together, capture errors as PHP Exceptions and use a simple yet powerful syntax. Works with any command line tool automagically.
Features
- Flexible and sexy syntax.
- Exceptions are thrown if the executable returns an error.
- Paths to binaries are automatically resolved.
- All arguments are properly escaped.
- Callback functions for streaming output.
Examples
Example: Tailing a file and adding timestamps to output
You can stream the output of a command into a callback function. For example:
Make sure the file 'log' exists. This will output a timestamp, and the input. Try echoing into the log file.
The escape codes are to add a little colour to the terminal.
Interactive Shell
ShellWrap also ships with an interactive shell mode. You can access this by typing:
Warning
Don't use any user inputted data with these commands. Even with very paranoid filtering, you can't know all the potential pitfalls of each command you're using. Use your noggin.
Acknowledgements
Inspired by the Python project sh by Andrew Moffat