PHPackages                             robo47/php-manipulator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. robo47/php-manipulator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

robo47/php-manipulator
======================

Manipulation of php code, automated refactoring based on phps tokenizer

48

Since Mar 10Compare

[ Source](https://github.com/robo47/PHP-Manipulator)[ Packagist](https://packagist.org/packages/robo47/php-manipulator)[ RSS](/packages/robo47-php-manipulator/feed)WikiDiscussions Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

PHP\\Manipulator
================

[](#phpmanipulator)

[![Build Status](https://camo.githubusercontent.com/941816a94e14ac9c604a876d62709c0d79ae3b8bbcaf8ed1bfa4b8ddd91c05c1/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f726f626f34372f5048502d4d616e6970756c61746f722e706e67)](robo47/PHP-Manipulator)

Table of Contents
-----------------

[](#table-of-contents)

- About PHP\\Manipulator
- Requirements
- Installation
- License
- Usage
- Project directory/file structure

About PHP\\Manipulator
----------------------

[](#about-phpmanipulator)

A command-line tool for manipulating php code.

PHP\\Manipulator is build to be easily extendable with your own Actions and Actionsets \[for example for configure multiple Actions forming a Coding-Standard or a special task for you project\] and configurable via a simple xml-file allowing to choose which files should be changed and which action(set)s should be used on those files.

Code ist hosted at  and directly installable via my PEAR-server pear.robo47.net.

Requirements
------------

[](#requirements)

PHP\\Manipulator requires PHP 5.3+ using features like namespaces and Closures.

extensions:

- spl
- tokenizer
- pcre
- dom

libraries:

- Symfony 2.0
- Console
- Finder
- PHPUnit 3.6 (unittests only)

configuration:

(both only if the code you want to manipulate contains them!) short\_open\_tag = On asp\_tags = On

Installation
------------

[](#installation)

Create a composer.json

```
{
    "require": {
        "robo47/php-manipulator": "*"
    }
}

```

Download and run composer

```
curl -s http://getcomposer.org/installer | php
php composer.phar install

```

License
-------

[](#license)

MIT

See file LICENSE.MIT

Usage
-----

[](#usage)

Running phpmanipulator:

```
bin/phpmanipulator

```

Run actions from a config:

```
bin/phpmanipulator runActions ./config.xml

```

Show tokens of a script

```
bin/phpmanipulator showTokens /path/to/script.php

```

Project directory/file structure
--------------------------------

[](#project-directoryfile-structure)

```
+-bin/phpmanipulator.php        # the phpmanipulator binary
+-helper/                       # Directory with templates for creating new Classes
+-src/
| +-PHP/                        # Here the actual PHP\Manipulators Code is located
+-tests/
| +-Baa/                        # Directory with Dummy-Files for testing Components, the Config and Loading
| +-Foo/                        # Directory with Dummy-Files for testing Components, the Config and Loading
| +-Tests
| | +-Constraint/               # Tests for special Constraints used in the tests
| | +-Stub/                     # Tests for Stub-Objects used in the tests
| | +-PHP/                      # HERE are the actual unittests for PHP\Manipulator
| | +-TestCase.php              # The base-TestCase Class with additional asserts using the new Constraints and some other methods
| | +-Util.php                  # Helper-Methods used in the Constraints and for Debugging while riding new Code
| +-_fixtures/                  # Containing all the php/xml-files used in the unittests ordered in subdirectories for each namespace below \PHP\Manipulator
| +- TestHelper.php             # Bootstrap-File for unittests setting include-path and setting up the Symfony-Autoloader
| +-phpunit.xml                 # Default config only Running Tests in /tests/Tests/PHP
| +-phpunitTests.xml            # Config only running tests of "testing-components" like the Constraints, the Stubs, the TestCase and the Util-class.
+-LICENSE                       # File containing the used New BSD-License for PHP\Manipulator
+-README                        # The file you are currently reading
+-TODO                          # List of todos, whishes, ideas and plans
+-build.xml                     # ant-build-script used mainly by hudson for running all tools around a build (phpunit, phpcpd, phpcs, phplint, phpunit, ... )
+-helper.php                    # Simple cli-script to create new Classes + unitests + empty fixture-files
+-phpmanipulator.xml            # Default configuration for running phpManipulator for enforcing coding-standard for itself by formatting/indenting code the right way (formatting not like expected yet!)
```

helper script
-------------

[](#helper-script)

The helper.php is only meant for development, it allows an easy and fast creation of new empty dummys for Actions, TokenConstraints, TokenManipulators, ContainerConstraints and TokenFinders including a unittest-file-dummy and empty fixture-files via the command line.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/00227460e374a3425259e09388877a783e5e79a00fc6958b193f336d6ef4015d?d=identicon)[robo47](/maintainers/robo47)

---

Top Contributors

[![robo47](https://avatars.githubusercontent.com/u/110477?v=4)](https://github.com/robo47 "robo47 (470 commits)")

### Embed Badge

![Health badge](/badges/robo47-php-manipulator/health.svg)

```
[![Health](https://phpackages.com/badges/robo47-php-manipulator/health.svg)](https://phpackages.com/packages/robo47-php-manipulator)
```

###  Alternatives

[liyu/dingo-serializer-switch

A middleware to switch dingo serializer

51139.9k2](/packages/liyu-dingo-serializer-switch)[balbuf/drupal-libraries-installer

Install Drupal libraries via a simple listing in your composer.json file

13223.4k1](/packages/balbuf-drupal-libraries-installer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
