PHPackages                             bastien-wink/php-class-diagram - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bastien-wink/php-class-diagram

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bastien-wink/php-class-diagram
==============================

A CLI tool that parses the PHP source directory and outputs PlantUML scripts.

0919PHP

Since Nov 24Pushed 3y agoCompare

[ Source](https://github.com/bastien-wink/php-class-diagram)[ Packagist](https://packagist.org/packages/bastien-wink/php-class-diagram)[ RSS](/packages/bastien-wink-php-class-diagram/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-class-diagram
=================

[](#php-class-diagram)

A CLI tool that parses the PHP source directory and outputs PlantUML class diagram scripts.

Forked from

Features
========

[](#features)

- Generating class diagrams from source code helps improve continuous design.
- Generates expressive class diagrams with an emphasis on namespaces and relationships.
- A simple CLI tool that is easy to handle.
- It is also possible to output a package relationship diagram that visualizes the dependency on the external namespace.

[![Latest Stable Version](https://camo.githubusercontent.com/27cc24a9e0e94986f9ab5933fc55ccd12a236c931d7abe70bbfca1c83c00fe95/687474703a2f2f706f7365722e707567782e6f72672f736d6567686561642f7068702d636c6173732d6469616772616d2f76)](https://packagist.org/packages/smeghead/php-class-diagram) [![Total Downloads](https://camo.githubusercontent.com/389c4133248f1096bd7068befbb6b8a44b0b1f4d78697e5eec242f9d4cda75cb/687474703a2f2f706f7365722e707567782e6f72672f736d6567686561642f7068702d636c6173732d6469616772616d2f646f776e6c6f616473)](https://packagist.org/packages/smeghead/php-class-diagram) [![Latest Unstable Version](https://camo.githubusercontent.com/dc9725a5b542bc0188985511aa4bc191bc10885f97ae352fd87d9b501cacfdae/687474703a2f2f706f7365722e707567782e6f72672f736d6567686561642f7068702d636c6173732d6469616772616d2f762f756e737461626c65)](https://packagist.org/packages/smeghead/php-class-diagram) [![License](https://camo.githubusercontent.com/ab98bc0f44d83f325be49979302b0f2bb83e7475dcc185884062bf70e6b11cdf/687474703a2f2f706f7365722e707567782e6f72672f736d6567686561642f7068702d636c6173732d6469616772616d2f6c6963656e7365)](https://packagist.org/packages/smeghead/php-class-diagram) [![PHP Version Require](https://camo.githubusercontent.com/0cb2f6b62a2e38d4a6f1c74eed20020cc706c5dad01cc82a5114783b8c5bd5a1/687474703a2f2f706f7365722e707567782e6f72672f736d6567686561642f7068702d636c6173732d6469616772616d2f726571756972652f706870)](https://packagist.org/packages/smeghead/php-class-diagram)

### php-class-diagram class diagram

[](#php-class-diagram-class-diagram)

[![dogfood class diagram image.](dogfood.png)](dogfood.png)

### php-class-diagram package related diagram

[](#php-class-diagram-package-related-diagram)

[![dogfood package related diagram image.](dogfood-package.png)](dogfood-package.png)

Install
-------

[](#install)

### From DockerHub

[](#from-dockerhub)

You can use docker image includes php-class-diagram and plantuml, from below URL.

-

### From Composer

[](#from-composer)

```
$ mkdir sample
$ cd sample
$ composer init
$ composer require --dev smeghead/php-class-diagram
```

you can execute `./vendor/bin/php-class-diagram`. for instance, try to display help message.

```
$ vendor/bin/php-class-diagram --help
usage: php-class-diagram [OPTIONS]

A CLI tool that parses the PHP source directory and outputs PlantUML class diagram scripts.

OPTIONS
  -h, --help                     show this help page.
      --class-diagram            output class diagram script. (default)
      --package-diagram          output package diagram script.
      --jig-diagram              output class diagram and package diagram script.
      --enable-class-properties  describe properties in class diagram. (default)
      --disable-class-properties not describe properties in class diagram.
      --enable-class-methods     describe methods in class diagram. (default)
      --disable-class-methods    not describe methods in class diagram.
      --php5                     parse php source file as php5.
      --php7                     parse php source file as php7.
      --php8                     parse php source file as php8. (not suppoted)
```

How to execute
--------------

[](#how-to-execute)

When three php source files that TYPE commented exist in `test/fixtures/no-namespace`,

- php source files.

```
└─test
    └─fixtures
        └─no-namespace
            └─product
                    Product.php
                    Name.php
                    Price.php

```

- Product.php

```
