2017 © Pedro PelĂĄez
 

library commander

Commander is a task manager/runner application for PHP.

image

gravitymedia/commander

Commander is a task manager/runner application for PHP.

  • Monday, September 5, 2016
  • by pCoLaSD
  • Repository
  • 1 Watchers
  • 0 Stars
  • 193 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Commander

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads Dependency Status, (*1)

Commander is a task manager/runner application for PHP., (*2)

Requirements

This application has the following requirements:, (*3)

  • PHP 5.6+
  • ext-pdo_sqlite

Usage

Commander was designed to be used as a type of SQLite based task manager and runner. You can add new tasks to the schedule, run them and watch the result. A task consists of a commandline which will be executed and an optional priority. For now the tasks are unique and can only be added once to the schedule., (*4)

You can use Commander in one of the three following ways., (*5)

As a Phar

This is the recommended way of using Commander. Download the latest Phar from the releases section., (*6)

Commander can then be executed out of the box by running:, (*7)

``` bash $ php commander.phar, (*8)


### As a global Composer package Install composer in your project: ``` bash $ curl -s https://getcomposer.org/installer | php

Require the package as a global dependency via Composer:, (*9)

``` bash $ php composer.phar global require gravitymedia/commander, (*10)


### As a Composer dependency Install composer in your project: ``` bash $ curl -s https://getcomposer.org/installer | php

Require the package as a dependency for development via Composer:, (*11)

``` bash $ php composer.phar require --dev gravitymedia/commander, (*12)


## Configuration Commander can be configured with a JSON file named `commander.json`. This file should be located in the current working directory. It's location can also be defined with the `--configuration` option. | Name | Description | |------------------|------------------------------------------------------------------------| | databaseFilePath | The file path to the database file | | cacheDirectory | The directory where the cache files will be stored (e.g. `.commander`) | | logFilePath | The file path to the log file (e.g. `commander.log`) | | processTimeout | The timeout after which every task will be killed | The following configuration complies with the default configuration: ``` json { "databaseFilePath": "commander.sqlite", "cacheDirectory": null, "logFilePath": null, "processTimeout": 60 }

Examples

You can list all the commands by running Commander without an argument., (*13)

For the following examples assume that Commander is available as a Phar in the current working directory., (*14)

Create new task or update existing task

``` bash $ php commander.phar join -- 'printf "Hello world!"' $ php commander.phar join --priority=1000 -- 'printf "Hello world!"' $ php commander.phar join -- 'printf "Let ms say hello:"', (*15)


The first command will join a task that will later print out `Hello world!`. The next command will change the priority of this task, so the next task will then run (with default priority) before this one. ### Show information about all joined tasks This command will list all tasks: ``` bash $ php commander.phar show

The output will be rendered as an ASCII table., (*16)

+--------------------------------------+----------+----------------------------+-----+-----------+---------------------+---------------------+
| ID                                   | Priority | Commandline                | PID | Exit Code | Created At          | Updated At          |
+--------------------------------------+----------+----------------------------+-----+-----------+---------------------+---------------------+
| 2E906453-41D6-4875-9678-67B3F130ADF6 | 1000     | printf "Hello world!"      |     |           | 2016-08-10 11:13:08 | 2016-08-10 11:13:28 |
| 441798A8-5F37-4147-B166-5A63C095B2DA | 1        | printf "Let me say hello:" |     |           | 2016-08-10 11:14:37 | 2016-08-10 11:14:37 |
+--------------------------------------+----------+----------------------------+-----+-----------+---------------------+---------------------+

Run all joined tasks

To run all joined tasks execute the following command:, (*17)

``` bash $ php commander.phar run, (*18)


The output will be printed to STDOUT and STDERR respectively. Use the `-q` option to omit the output. When a log file path was specified, the output will also be logged. ### Remove all terminated tasks To reduce the number of tasks in the database the terminated tasks can be purged of the database file: ``` bash $ php commander.phar purge

Contributing

Please see CONTRIBUTING for details., (*19)

Credits

License

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

The Versions