The command-line interface is the easiest way to try and learn the basic Reflect features.
![]() | |
For all users. |
Without plugins
and analysers
sections in your phpreflect.json
configuration file,
when you invoke the phpreflect
command, you should obtain the following commands and options :
phpReflect version 2.4.0 build ... Usage: [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version -V Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction -n Do not ask any interactive question. --profile Display timing and memory usage information. Available commands: help Displays help for a command list Lists commands plugin plugin:list List all plugins installed. provider provider:display Show source of a file in a data source. provider:list List all data source providers. provider:show Show list of files in a data source.
plugin:list |
List all plugins configured (and correctly installed) in Without plugins, you will get. $ phpreflect plugin:list
[Json Configuration] No plugins detected. With only $ phpreflect plugin:list
Plugin Name Plugin Class Events Subscribed Analyser Bartlett\Reflect\Plugin\Analyser\AnalyserPlugin reflect.complete |
provider:list |
List all data source providers configured in Result may vary depending of your current directory, but you will get something like. $ phpreflect provider:list
Source Alias Files . current 46 |
provider:show |
Show list of files corresponding to the (Symfony) Finder rules defined. With Reflect source files. $ phpreflect provider:show .
Possible alternative. $ phpreflect provider:show --alias current
Source Files . 46 Relative Path Name Date Size Bartlett\Reflect\Analyser\AbstractAnalyser.php 2014-02-03T17:25:07+01:00 3475 Bartlett\Reflect\Analyser\AnalyserInterface.php 2014-02-03T17:26:50+01:00 835 Bartlett\Reflect\Analyser\StructureAnalyser.php 2014-02-23T17:31:16+01:00 12798 <... more lines ...> |
provider:display |
Show source code of a file in one of the data source identified. With $ phpreflect provider:display . Bartlett\Reflect.php
Possible alternative. $ phpreflect provider:display --alias current Bartlett\Reflect.php
Source . Relative Path Name Date Size Id Token Line Text 0 T_OPEN_TAG 1 <?php 1 T_DOC_COMMENT 2 /** * Reflect * Reverse-engineer 2 T_WHITESPACE 15 3 T_NAMESPACE 17 namespace 4 T_WHITESPACE 17 5 T_STRING 17 Bartlett 6 T_SEMICOLON 17 ; <... more lines ...> |
When the Analyser
plugin is installed, following lines added into analysers
section
{ "name": "Analyser", "class": "Bartlett\\Reflect\\Plugin\\Analyser\\AnalyserPlugin" }
you will get two additionnal commands.
analyser:list |
List all analysers configured in Without analysers, you will get. $ phpreflect analyser:list
[Json Configuration] No analysers detected. With only $ phpreflect analyser:list
Analyser Name Analyser Class Structure Bartlett\Reflect\Analyser\StructureAnalyser |
analyser:run |
Parse a data source and display results. May wary depending of the data source and analyser used. With $ phpreflect analyser:run .
Possible alternative. $ phpreflect analyser:run --alias current
Data Source Analysed Directories 16 Files 47 Structure Namespaces 16 Interfaces 0 Traits 0 Classes 39 Abstract Classes 5 (12.82%) Concrete Classes 34 (87.18%) Methods 269 Scope Non-Static Methods 263 (97.77%) Static Methods 6 (2.23%) Visibility Public Method 243 (90.33%) Protected Method 26 (9.67%) Private Method 0 (0.00%) Functions 5 Named Functions 0 (0.00%) Anonymous Functions 5 (100.00%) Constants 105 Global Constants 104 (99.05%) Class Constants 1 (0.95%) |
When the plantUML
plugin is installed, following lines added into plugins
section
{ "name": "PlantUML", "class": "Bartlett\\Reflect\\Plugin\\PlantUML\\PlantUMLPlugin" }
you will get one additionnal command.
plantUML:run |
Parse a data source and draw corresponding UML diagrams (package or class) with the PlantUML syntax. Build a package diagram corresponding to $ phpreflect plantUML:run --package=Bartlett\Reflect\Model .
Possible Alternative. $ phpreflect plantUML:run --package=Bartlett\Reflect\Model --alias current
PlantUML package diagram package "Bartlett\\Reflect\\Model" { abstract AbstractFunctionModel abstract AbstractModel class ClassModel class ConstantModel class DependencyModel class FunctionModel class IncludeModel class MethodModel class PackageModel class ParameterModel class PropertyModel } It’s now time to produce PNG images. Put previous PlantUML code syntax into a text file (e.g named $ java -jar plantuml.jar packageDiagram.plantuml And you should obtain a PNG image like this one Build a class diagram corresponding to $ phpreflect plantUML:run --class=Bartlett\Reflect\Builder .
Possible Alternative. $ phpreflect plantUML:run --class=Bartlett\Reflect\Builder --alias current
PlantUML class diagram set namespaceSeparator none namespace Bartlett.Reflect { class Builder { -packages -classes -interfaces -traits -functions -constants -includes -dependencies -file -namespace -- +setCurrentFile() +beforeTraverse() +enterNode() +leaveNode() #parseNewStatement() #parseUserConstant() #parseUserFunction() #parseInternalFunction() #parseFunctionArguments() +buildPackage() +buildClass() +buildInterface() +buildTrait() +buildFunction() +buildConstant() +buildInclude() +buildDependency() +buildFromCache() +getPackages() +getClasses() +getInterfaces() +getTraits() +getFunctions() +getConstants() +getIncludes() +getDependencies() } } It’s now time to produce PNG images. Put previous PlantUML code syntax into a text file (e.g named $ java -jar plantuml.jar classDiagram.plantuml And you should obtain a PNG image like this one |