2017 © Pedro PelĂĄez
 

library cli-array-editor

This library provides an easy way to edit arrays in CLI using vim or your preferred editor.

image

mcuadros/cli-array-editor

This library provides an easy way to edit arrays in CLI using vim or your preferred editor.

  • Monday, April 8, 2013
  • by mcuadros
  • Repository
  • 2 Watchers
  • 1 Stars
  • 989 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

CLIArrayEditor Build Status

This library provides an easy way to edit arrays in CLI using vim or your preferred editor., (*1)

Can be useful in scenarios where we need an interface to edit arrays from a CLI PHP application, CLIArrayEditor will open an editor with the array in a readable format (json, yaml, etc) and wait for the user (like "crontab -e" or "git commit")., (*2)

The editor can be configured or by default $EDITOR from the environment will be used., (*3)

Requirements

  • PHP 5.3.23;
  • Unix system;
  • PECL yaml >= 0.5.0 (optional)

Installation

The recommended way to install CLIArrayEditor is through composer. You can see package information on Packagist., (*4)

{
    "require": {
        "mcuadros/cli-array-editor": "dev"
    }
}

Examples

use CLIArrayEditor\Editor;
use CLIArrayEditor\Format\JSON;

$tmp = array(
    'baz' => true,
    'foo' => 'bar'
);

$editor = new Editor();
$result = $editor
    ->setFormat(new JSON)
    ->edit($tmp);

print_r($result);

Check available Editor's methods in src/CLIArrayEditor/Editor.php, (*5)

Tests

Tests are in the tests folder. To run them, you need PHPUnit. Example:, (*6)

$ phpunit --configuration phpunit.xml.dist

License

MIT, see LICENSE, (*7)

The Versions

08/04 2013

dev-master

9999999-dev http://github.com/mcuadros/cli-array-editor

This library provides an easy way to edit arrays in CLI using vim or your preferred editor.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

cli editor vim