Download the PHP package smeghead/php-class-diagram without Composer
On this page you can find all versions of the php package smeghead/php-class-diagram. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download smeghead/php-class-diagram
More information about smeghead/php-class-diagram
Files in smeghead/php-class-diagram
Package php-class-diagram
Short Description A CLI tool that parses the PHP source directory and outputs PlantUML scripts.
License Apache-2.0
Informations about the package php-class-diagram
php-class-diagram
A CLI tool that parses the PHP source directory and generates PlantUML class diagram scripts as output.
Features
- β»οΈ Generating class diagrams from source code contributes to continuous design improvement.
- π It produces expressive class diagrams with a focus on namespaces and relationships.
- π Diagrams are interactive hypermedia tools, allowing you to click on class boxes to navigate directly to the source code, enhancing understanding both visually and interactively.
- π§ This simple CLI tool is easy to use.
- π‘ Additionally, it can generate a package relationship diagram to visualize dependencies on external namespaces.
What is PlantUML
PlantUML - Wikipedia PlantUML is an open-source tool allowing users to create diagrams from a plain text language. Besides various UML diagrams, PlantUML has support for various other software development related formats (such as Archimate, Block diagram, BPMN, C4, Computer network diagram, ERD, Gantt chart, Mind map, and WBD), as well as visualisation of JSON and YAML files.
Hypermedia Feature
One of the standout features of this tool is the ability to generate class diagrams with clickable links that navigate directly to the source code of those classes. This transforms the diagrams into interactive hypermedia tools, enhancing the understanding of the source code visually and interactively.
To enable this feature, generate the diagrams in SVG format and use the --svg-topurl
option to specify the base URL for the links:
To embed the SVG diagrams in HTML while preserving the clickable links, use the embed
or object
tags instead of img
. Hereβs an example:
This ensures that the SVG image is responsive and the hyperlinks remain functional.
Dogfooding
php-class-diagram class diagram (linked SVG file)
php-class-diagram class diagram without fields and methods
If your analysis primarily focuses on the relationships between classes, a simpler notation may be more appropriate.
php-class-diagram package related diagram
Visualizing package relationships can uncover critical design issues.
Install
From DockerHub
You can utilize a Docker image that includes php-class-diagram and PlantUML from the following URL.
From Composer
Now, you can execute ./vendor/bin/php-class-diagram
.
For instance, try to display help message.
How to execute
Class Diagram
If there are three PHP source files in the directory test/fixtures/no-namespace each with a TYPE comment,
-
php source files.
-
Product.php
-
Name.php
- Price.php
Executing php-class-diagram
will output the PlantUML script.
Use PlantUML to convert the PlantUML script to an image.
option header
You can specify the string to be output to the PlantUML header.
option include
You can add patterns to specify the target files for processing.
option exclude
You can specify patterns to exclude files from the processing.
Package Diagram
You can visualize package dependencies by creating a package relationship diagram using php-class-diagram.
Packages that depend on each other are undesirable. If the tool detects such dependencies, it will issue a warning with a thick red line.
Division Diagram
If you are utilizing the Enum feature introduced in PHP 8.1, you can generate the division diagram. Visualizing the divisions employed in the program can be beneficial for research and design purposes.
GitHub Actions support
The following repository provides actions for generating class diagrams using php-class-diagram in GitHub Actions workflows.
smeghead/php-class-diagram-gh-action
Development
Open shell
install dependencies
execute tests
CONTRIBUTING
Both Issues and Pull Requests are welcome!
All versions of php-class-diagram with dependencies
symfony/finder Version ^5.3|^6.0|^7.0
nikic/php-parser Version ^5.2
phpstan/phpdoc-parser Version ^1.30