2017 © Pedro Peláez
 

library systemctl-php

PHP wrapper for systemctl

image

icanhazstring/systemctl-php

PHP wrapper for systemctl

  • Thursday, July 19, 2018
  • by icanhazstring
  • Repository
  • 2 Watchers
  • 18 Stars
  • 2,102 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 10 Open issues
  • 11 Versions
  • 20 % Grown

The README.md

systemctl-php

CI PipelineCode Climate Test Coverage Join the chat at https://gitter.im/icanhazstring/systemctl-php, (*1)

PHP wrapper for systemctl, (*2)

How to install

$ composer require icanhazstring/systemctl-php

Current supported units

See Units, (*3)

If you like to add support for more units, feel free to grab an issue and contribute., (*4)

Current supported commands

  • start
  • stop
  • enable
  • disable
  • reload
  • restart
  • isEnabled
  • isActive

If you like to add support for more commands, feel free to contribute., (*5)

How to change the binary

SystemCtl::setBinary('/bin/systemctl');

How to change command timeout

To change command tmeout simply call the static method setTimeout., (*6)

SystemCtl::setTimeout(10);

The default timeout is set to 3 seconds, (*7)

"I need sudo to run commands"

If you need sudo, you should execute the bin executable with sudo. The incode support was dropped due to security reason., (*8)

How do I start/stop/restart a unit?

Simply is that. First we instantiate a SystemCtl instance an load a unit from a specific type. Here we use a Service. You will always get back true if the command succeeded. Otherwise the method will throw a CommandFailedException., (*9)

$systemCtl = new SystemCtl();

// start/stop/enable/disable/reload/restart
$systemCtl->getService('nginx')->start();
$systemCtl->getService('nginx')->stop();

How to Contribute

Clone the repo and install using composer, (*10)

$ composer install

Make your changes and make sure you run test and codesniffer., (*11)

$ composer test
> vendor/bin/phpunit tests/
PHPUnit 6.1.4 by Sebastian Bergmann and contributors.

........                                                            8 / 8 (100%)

Time: 130 ms, Memory: 2.00MB

OK (8 tests, 13 assertions)

$ composer cs
> vendor/bin/phpcs --standard=PSR2 src/ && vendor/bin/phpcs --standard=PSR2 tests/

$

Credits

This library is heavily influenced by @mjanser php-systemctl., (*12)

The Versions

03/06 2018

dev-master

9999999-dev

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring

27/02 2018

0.x-dev

0.9999999.9999999.9999999-dev

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring

22/08 2017

v1.0-rc.1

1.0.0.0-RC1

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring

21/08 2017

v0.6

0.6.0.0

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring

16/08 2017

v0.5

0.5.0.0

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring

04/07 2017

v0.4

0.4.0.0

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring

07/06 2017

v0.3.1

0.3.1.0

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring

07/06 2017

v0.3

0.3.0.0

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring

02/06 2017

v0.2

0.2.0.0

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring

23/05 2017

v0.1

0.1.0.0

PHP wrapper for systemctl

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar icanhazstring