Skip to content

Static code analyzer for message flow in a prooph powered project

License

Notifications You must be signed in to change notification settings

prooph/message-flow-analyzer

 
 

Repository files navigation

prooph message flow analyzer

Build Status Coverage Status Gitter

A static code analyzer to extract a message flow of a prooph project. Results can be visualized in the prooph Mgmt UI.

Model Exploration

Installation

composer require --dev prooph/message-flow-analyzer

Configuration

The analyzer can be configured using a json file. By default the analyzer uses a prooph_analyzer.json located in the current working directory. An example of a default config can be found in the test example project

Run

php vendor/bin/prooph-analyzer project:analyze -vvv

Why?

The prooph message flow analyzer scans your project for prooph messages and collects information how these messages flow through your system :)

The analysis contains information about:

  • commands, events, queries
  • message handlers per message (command handler, event listner, process manager, ...)
  • message producers per message (controller, cli commands, process manager, ...)
  • event recorders per event (classes implementing prooph's AggregateRoot or using the EventProducerTrait)

The message flow is written to an output file (prooph_message_flow.json by default).

How?

The package uses the excellent libraries roave/better-reflection and nikic/php-parser (which is used by Roave/BetterReflection internally, too)

Filters

You can add include and exclude filters for files and directories. prooph/message-flow-analyzer ships with some default filters. Check the linked example config above. The filter implementations can be found in the Filter dir

ClassVisitors

Class visitors are called for every php class found in the project and not excluded by a filter. They take a Roave\BetterReflection\Reflection\ReflectionClass and the Prooph\MessageFlowAnalyzer\MessageFlow as input and if a visitor finds something interesting in the class it can add this information to the MessageFlow.

Again prooph/message-flow-analyzer ships with default class visitors (see example config) which can be found in the Visitor dir.

Documentation

Documentation is in the doc tree, and can be compiled using bookdown.

$ php ./vendor/bin/bookdown docs/bookdown.json
$ php -S 0.0.0.0:8080 -t docs/html/

Run it against proophessor-do

You can see the prooph/message-flow-analyzer in action by running it against proophessor-do or proophessor-do-symfony.

Support

Contribute

Please feel free to fork and extend existing or add new plugins and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.

License

Released under the New BSD License.

About

Static code analyzer for message flow in a prooph powered project

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages