Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Command line library for PHP that allows to call programs as functions.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 composer.json
Octocat-spinner-32 phpunit.xml
README.md

Command line library for PHP that allows to call programs as functions.

Build Status

Inspired in Python Sh library (http://amoffat.github.com/sh/)

usage examples:

<?php
error_reporting(-1);

// include PSR-0 autoloader
include __DIR__ . '/../vendor/autoload.php';

use Sh\Sh;

// Simple command using factory
echo Sh::factory()->runCommand('notify-send', array('-t', 5000, 'title', 'HOLA'));

// with instance
$sh  = new Sh();
echo $sh->ifconfig("eth0");

echo $sh->ls('-latr ~');

echo $sh->ls(array('-latr', '~'));

$sh->tail('-f /var/log/apache2/access.log', function ($buffer)  {
    echo $buffer;
});

// chainable commands (baking)
$sh->ssh(array('myserver.com', '-p' => 1393))->whoami();
// executes: ssh myserver.com -p 1393 whoami

$sh->ssh(array('myserver.com', '-p' => 1393))->tail(array("/var/log/dumb_daemon.log", 'n' => 100));
// executes: ssh myserver.com -p 1393 tail /var/log/dumb_daemon.log -n 100
});

Composer require:

    "require":{
        "gonzalo123/sh": "v1.0",
        "symfony/process":"dev-master"
    },`

https://packagist.org/packages/gonzalo123/sh

Something went wrong with that request. Please try again.