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

https://github.com/dantleech/phptool

Project inflection and refactoring tool
https://github.com/dantleech/phptool

Last synced: over 1 year ago
JSON representation

Project inflection and refactoring tool

Awesome Lists containing this project

README

          

PHPTool
=======

[![Build Status](https://travis-ci.org/phptool/phptool.svg?branch=master)](https://travis-ci.org/phptool/phptool)
[![StyleCI](https://styleci.io/repos//shield)](https://styleci.io/repos/)

Refactoring tool.

- Scans and stores metadata on all classes in your project.
- Uses static analysis to generate reflection data.
- Search for a class (and optionally dump metainfo as JSON).
- Apply refactorings to classes.

**DISCLAIMER**: This was written in haste and without even a single test. It
is currently just for personal use, in short:

#### DON'T USE IT!!

Usage
-----

Create the sqlite datbaase:

```bash
$ phptool dbal:migrate
```

Scan your project:

```bash
$ phptool scan path/to/files
```

Find a class by class or file:

```bash
$ phptool find "Symfony\\Component\\Finder\\Glob"
$ # or
$ phptool find vendor/symfony/finder/Glob.php
+------------------+-------------------------------------------------------------------+
| path | /home/daniel/www/dantleech/phptool/vendor/symfony/finder/Glob.php |
| fqn | Symfony\Component\Finder\Glob |
| extends | |
| interfaces | |
| property fetches | |
| properties | |
| methods | toRegex |
+------------------+-------------------------------------------------------------------+
```

Refactor files:

```bash
$ /bin/phptool refactor tests/Unit/Scanner/ScannerTest.php --worker=property_fixer
```

Inflecting the file name from a class name (class does not need to exist, uses
composer):

```bash
$ # inflect the filename from a class name
$ phptool inflect:class DTL\\PhpTool\\Foo\\Bar\\Bar
lib/Foo/Bar/Bar.php

$ # uses composer and includes autoload-dev
$ phptool inflect:class DTL\\PhpTool\\Tests\\Unit\\Foo\\Bar\\Bar
tests/Unit/Foo/Bar/Bar.php

$ # Inflect class names from filenames
$ phptool inflect:file lib/Extension/CoreExtension.php
DTL\PhpTool\Extension\CoreExtension
```