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
- Host: GitHub
- URL: https://github.com/dantleech/phptool
- Owner: dantleech
- License: mit
- Created: 2016-06-19T12:32:59.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-19T14:51:26.000Z (about 10 years ago)
- Last Synced: 2025-01-30T15:44:24.512Z (over 1 year ago)
- Language: PHP
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHPTool
=======
[](https://travis-ci.org/phptool/phptool)
[](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
```