Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gnugat/redaktilo

[maintained] An easy "line manipulation" PHP lib: jump, insert and do anything!
https://github.com/gnugat/redaktilo

Last synced: 1 day ago
JSON representation

[maintained] An easy "line manipulation" PHP lib: jump, insert and do anything!

Awesome Lists containing this project

README

        

# Redaktilo

Redaktilo allows you to find, insert, replace and remove lines using an
editor-like object.

*Because your code too needs an editor to manipulate files*.

## Getting started

Use [Composer](http://getcomposer.org/) to install Redaktilo in your projects:

```console
$ composer require "gnugat/redaktilo:^2.0"
```

Redaktilo provides an `Editor` class which can be instanciated using
`EditorFactory`:

```php
editor = $editor;
$this->appKernelFilename = $appKernelFilename;
}

public function addBundle($bundle)
{
$appKernel = $this->editor->open($this->appKernelFilename);
$newBundle = " new $bundle(),";
if ($this->editor->hasBelow($appKernel, $newBundle)) {
$message = sprintf('Bundle "%s" is already defined in "AppKernel::registerBundles()".', $bundle);

throw new \RuntimeException($message);
}
$this->editor->jumpBelow($appKernel, ' );');
$this->editor->insertAbove($appKernel, $newBundle);
$this->editor->save($appKernel);

return true;
}
}
```

As you can see it's easier to read and to understand than
[the original PHP token parsing](https://github.com/sensiolabs/SensioGeneratorBundle/blob/8b7a33aa3d22388443b6de0b0cf184122e9f60d2/Manipulator/KernelManipulator.php).

## Further documentation

You can see the current and past versions using one of the following:

* the `git tag` command
* the [releases page on Github](https://github.com/gnugat/redaktilo/releases)
* the file listing the [changes between versions](CHANGELOG.md)

You can find more documentation at the following links:

* [copyright and MIT license](LICENSE)
* [versioning and branching models](VERSIONING.md)
* [contribution instructions](CONTRIBUTING.md)
* [migration to 2.0 instructions](UPGRADE-2.0.md)

Next readings:

* [Tutorial](doc/01-tutorial.md)
* [Use cases](doc/02-use-cases.md)
* [Reference](doc/03-reference.md)
* [Vocabulary](doc/04-vocabulary.md)
* [Extending](doc/05-extending.md)
* [Exceptions](doc/06-exceptions.md)