Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.
/ Command Public archive

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

License

Notifications You must be signed in to change notification settings

N0rthernL1ghts/Command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Command

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages