2017 © Pedro PelĆ”ez
 

library redaktilo

Find, insert, replace and remove lines with an Editor-like object

image

gnugat/redaktilo

Find, insert, replace and remove lines with an Editor-like object

  • Friday, July 21, 2017
  • by gnupat
  • Repository
  • 8 Watchers
  • 82 Stars
  • 80,627 Installations
  • PHP
  • 7 Dependents
  • 0 Suggesters
  • 8 Forks
  • 5 Open issues
  • 47 Versions
  • 9 % Grown

The README.md

Redaktilo

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

Because your code too needs an editor to manipulate files., (*2)

Getting started

Use Composer to install Redaktilo in your projects:, (*3)

$ composer require "gnugat/redaktilo:^2.0"

Redaktilo provides an Editor class which can be instanciated using EditorFactory:, (*4)

<?php
require_once __DIR__.'/vendor/autoload.php';

use Gnugat\Redaktilo\EditorFactory;

$editor = EditorFactory::createEditor();

Real life example

For our example, we will create a KernelManipulator similar to the one we can find in SensioGeneratorBundle., (*5)

It takes a bundle's fully qualified classname and inserts it in the AppKernel file:, (*6)

<?php

namespace Sensio\Bundle\GeneratorBundle\Manipulator;

use Gnugat\Redaktilo\Editor;

class KernelManipulator extends Manipulator
{
    protected $editor;
    protected $appKernelFilename;

    public function __construct(Editor $editor, $appKernelFilename)
    {
        $this->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., (*7)

Further documentation

You can see the current and past versions using one of the following:, (*8)

You can find more documentation at the following links:, (*9)

Next readings:, (*10)

The Versions

21/07 2017

dev-master

9999999-dev

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

21/07 2017

v1.7.3

1.7.3.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

01/12 2015

v1.7.2

1.7.2.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

01/12 2015

v1.7.1

1.7.1.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

06/04 2015

dev-fix-notice

dev-fix-notice

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

10/01 2015

dev-release-2.0.0

dev-release-2.0.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

10/01 2015

v1.7.0

1.7.0.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

09/12 2014

v1.6.0

1.6.0.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

29/11 2014

v1.5.0

1.5.0.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

16/11 2014

v1.4.0

1.4.0.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

02/11 2014

v1.3.0

1.3.0.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

31/10 2014

v1.2.1

1.2.1.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

21/10 2014

v1.2.0

1.2.0.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

15/10 2014

v1.1.6

1.1.6.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

15/10 2014

v1.1.5

1.1.5.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

09/10 2014

v1.1.4

1.1.4.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

09/10 2014

v1.1.3

1.1.3.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

08/10 2014

v1.1.2

1.1.2.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

08/10 2014

v1.1.1

1.1.1.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

06/10 2014

v1.1.0

1.1.0.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

09/09 2014

v1.0.0

1.0.0.0

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

02/09 2014

v1.0.0-rc3

1.0.0.0-RC3

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

24/08 2014

v1.0.0-rc2

1.0.0.0-RC2

Find, insert, replace and remove lines with an Editor-like object

  Sources   Download

MIT

The Requires

 

The Development Requires

file editor edit insert replace remove find lines

21/08 2014

v1.0.0-rc1

1.0.0.0-RC1

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

20/08 2014

v1.0.0-beta2

1.0.0.0-beta2

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

20/08 2014

v1.0.0-beta1

1.0.0.0-beta1

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

20/08 2014

v1.0.0-alpha7

1.0.0.0-alpha7

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

20/08 2014

v1.0.0-alpha6

1.0.0.0-alpha6

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

09/08 2014

v1.0.0-alpha5

1.0.0.0-alpha5

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

06/08 2014

v1.0.0-alpha4

1.0.0.0-alpha4

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

13/06 2014

v1.0.0-alpha3

1.0.0.0-alpha3

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

13/06 2014

v1.0.0-alpha2

1.0.0.0-alpha2

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

13/06 2014

v1.0.0-alpha1

1.0.0.0-alpha1

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

09/06 2014

v0.9.0

0.9.0.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

01/06 2014

v0.8.0

0.8.0.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

24/05 2014

v0.7.2

0.7.2.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

24/05 2014

v0.7.1

0.7.1.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

24/05 2014

v0.7.0

0.7.0.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

19/05 2014

v0.6.1

0.6.1.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

19/05 2014

v0.6.0

0.6.0.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

14/05 2014

v0.5.0

0.5.0.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

10/05 2014

v0.4.0

0.4.0.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

08/05 2014

v0.3.0

0.3.0.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Requires

 

The Development Requires

04/05 2014

v0.2.0

0.2.0.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Development Requires

28/04 2014

v0.1.2

0.1.2.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Development Requires

28/04 2014

v0.1.1

0.1.1.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Development Requires

28/04 2014

v0.1.0

0.1.0.0

An editor allowing you to modify files programmatically

  Sources   Download

MIT

The Development Requires