# VisualizerTask

The `VisualizerTask` generates a graphical representation of your current buildfile. This allows you to see all available targets but also the calls and dependencies among targets.

`VisualizerTask` is able to represent:

- Target's depends

- RunTargetTask

- PhingCallTask

- ForeachTask

## Basic attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`format` | `String` | Diagram's format. Supported formats are: `png`, `svg`, `puml` and `eps`. | `png` | no
`destination` | `String` | Location where the diagram will be saved. It could be a file or directory path. | Same location as current `buildfile` | no
`footer` | `String` | A text to display at the bottom right of the diagram. | n/a | no
`showTitle` | `Bool` | Should the buildfile's title be displayed in diagram? | `true` | no
`showDescription` | `Bool` | Should the buildfile's description be displayed in diagram? | `false` | no
`direction` | `String` | Use this to change the diagram's layout. Valid values are: `horizontal` and `vertical`. | `vertical` | no
`server` | `String` | PlantUML server. Needed by all formats except `puml`. | http://www.plantuml.com/plantuml | no

If you have network connectivity issues, you should try `puml` format. This format doesn't require a PlantUML server (and therefore an internet connection) to generate a diagram.

## Examples

Using `VisualizerTask` with default values:

    <visualizer/>

Setting diagram's format to `svg` with `horizontal` arrows:

    <visualizer format="svg" direction="horizontal"/>

Save diagram into `resources/images/` directory:

    <visualizer destination="resources/images/"/>

Display buildfile's description and custom footer text:

    <visualizer showDescription="true" footer="© Copyright 2021"/>

## Limitations

- Special target naming is not interpreted by `VisualizerTask`, targets' names are used as is. Please read Target Overriding for more details.

- As said before, `VisualizerTask` depends on a remote PlantUML server. Even if only buildfile's name and targets' names are sent to server, please be sure you are not sending any sensible information.

- PlantUML limits image width and height to 4096 pixels. Overcoming this limitation will require to configure your own PlantUML server and to configure it according to PlantUML FAQ instructions.

## Requirements

To work properly, `VisualizerTask` needs to have the following installed:

- SimpleXML extension

- XSL extension

- Guzzle

- jawira/plantuml-client

## Advanced HTTP configuration

As said before `VisualizerTask` needs a remote server to generate the diagrams. In order to configure the connection with remote server, several attributes and nested tags are available.

Because `VisualizerTask` relies on an internal Phing's library, these attributes and nested tags are shared among these tasks: HttpGetTask, HttpRequestTask and VisualizerTask.

### HTTP attributes

Use the following attributes if your PlanUML server requires an authentication mechanism.

#### Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`authUser` | `String` | The authentication user name | n/a | No
`authPassword` | `String` | The authentication password | n/a | No
`authScheme` | `String` | The authentication scheme | basic | No

### Supported Nested Tags

- `config`

  Holds additional config data. See Guzzle documentation for supported values.

  #### Attributes

  Name | Type | Description | Default | Required
  --- | --- | --- | --- | ---
  `name` | `String` | Config parameter name | n/a | Yes
  `value` | Mixed | Config value | n/a | Yes

- `header`

  Holds additional header `name` and `value`.

  #### Attributes

  Name | Type | Description | Default | Required
  --- | --- | --- | --- | ---
  `name` | `String` | Header name | n/a | Yes
  `value` | `String` | Header value | n/a | Yes

### Global configuration

In addition to configuring a particular instance of `Guzzle` via nested `<config>` tags it is also possible to set default configuration values for HttpGetTask / HttpRequestTask / VisualizerTask by setting `phing.http.*` properties.

    <property name="phing.http.proxy" value="socks5://localhost:1080/"/>

    <!-- This request will go through the default proxy -->
    <visualizer/>

    <visualizer>
        <!-- This proxy will be used instead of the default one -->
        <config name="proxy" value="http://foo:bar@proxy.example.org:3128/"/>
        <header name="user-agent" value="Phing VisualizerTask"/>
    </visualizer>