This package is abandoned and no longer maintained. No replacement package was suggested.

Command is small library providing execution of system commands in OOP way

1.2.0 2018-05-01 22:27 UTC

This package is auto-updated.

Last update: 2022-03-25 15:13:46 UTC


README

Maintainability

Command is small library providing execution of system commands in OOP way

Deprecation

I have decided to deprecate this project. If you want to take over and continue maintaining it, welcome contact me.
This repository is archived and there will be no further updates.
The reason is that symfony/process is everything this project is, and was intended to be, but so much better, actively maintained and fully mature, so there is really no reason for this project to exist.

Install

Via Composer

$ composer require northern-lights/command

It really is that easy!

Usage

<?php

namespace NorthernLights\Command\Example;

use NorthernLights\Command\Result\CommandResultInterface;
use function NorthernLights\Command\Run as command;

require __DIR__ . '/vendor/autoload.php';

/** @var CommandResultInterface $result */
$result = command('ls -all');

if ($result->isOk()) {
    // Note: $result->getOutput() will return an instance of OutputInterface which implements __toString()
    echo $result->getOutput() . PHP_EOL;
} else {
    echo "Command failed with status code " . $result->getExitCode() . PHP_EOL;
}

See Example

Please pay attention to line "use function NorthernLights\Command\Run as command" which is crucial as it assigns function NorthernLights\Command\Run to commmand alias.

If you don't want to use this way, see Run function declaration

PSR-2 Standard

Library strives to comply with PSR-2 coding standards, therefore we included following commands:

$ composer check-style
$ composer fix-style

Note: Second command will actually modify files

PSR-4 Standard

Library complies with PSR-4 autoloading standard

Testing

$ composer php-lint
$ composer test

License

The MIT License (MIT). Please see License File for more information.