Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

How to generate class diagrams, UML diagrams and architect diagrams for php programs/projects?

There are many options avaialble which may help you for generating class diagrams, UML diagrams and architect diagrams for php programs/projects?

GraphML
This class can be used to generate UML diagrams from PHP code using GraphML. It traverses a given directory to locate and parse PHP files. It scans the files for classes and their variables functions. The class can generate UML diagrams in the GraphML format from the classes that were found.

PHP2XMI
This PHP console script generates an XMI scheme (1.3) representing your classes and interfaces. The XMI scheme can be imported into UML modelers like umbrello to browse, print, think about your library/application design. The PHP2XMI script is licensed under the terms of the LGPL (GNU LESSER GENERAL PUBLIC LICENSE) contained in the COPYING file of this package.

FEATURES

  • public, protected, private, abstract, static, interface, extends, implements method argument type discovery through php5 type hinting
  • @package support (package and subpackages separated by dots)
  • @param type support
  • @return type support
  • @type attribute support (PHP 5.1.X only)
  • Uses PHP5 builtin reflection which gives good performances

PHP_UML

PHP_UML is a PHP parser, an XMI generator and a documentation tool. Practically, with PHP_UML, you will be able to feed a UML CASE tool, like Rational Rose or Argouml, with a UML representation of existing PHP source code. This way, you get an instant overview of a PHP application, with all the usual functions of a software design tool (such as class diagrams exportation, refactoring of object-oriented applications, or automatic code generation).

FEATURES

  • Can generate UML/XMI files in version 1.4, or in version 2.1 (logical, component, and deployment views)
  • Can generate an API documentation in HTML format
  • Can generate PHP code (code skeleton) from a given XMI file
  • Can convert UML/XMI content from version 1.4 to version 2.1
  • Parses object-oriented PHP code, in all versions (classes, interfaces, functions, properties…)
  • From version 1.5, PHP_UML can also parse procedural code (functions and constants). See the “htmlnew” exportation format
  • Interprets the PHP namespacing instructions (namespace and use)
  • Parses comment docblocks: class (@package), function (@param, @return), property (@var) and header file comments (@package)
  • Detects types (by parsing the type hints, and by analyzing the default values)

phUML
phUML is fully automatic UML diagram generator. It takes arbitrary object oriented code written in php5 and creates fully blown class diagrams of it. phUML is fully automatic UML class diagramm generator written in PHP, licensed under the BSD license. It is capable of parsing any PHP5 object oriented source code and create an appropriate image representation of the oo structure based on the UML specification.

FEATURES

  • Can generate UML/XMI files in version 1.4, or in version 2.1 (logical, component, and deployment views)
  • Can generate an API documentation in HTML format
  • Can generate PHP code (code skeleton) from a given XMI file
  • Can convert UML/XMI content from version 1.4 to version 2.1

Reference

  • https://github.com/jakobwesthoff/phuml
  • https://dasunhegoda.com/class-diagram-from-php-code-using-phuml/867/
  • https://pear.php.net/package/PHP_UML/

BOUML
BOUML is a free UML 2 tool box including a modeler allowing you to specify and generate code in C++, Java, Idl, Php, Python and MySQL. Since the release 7.0 BOUML is again a free software. BOUML runs under Windows, Linux and MacOS X. BOUML is very fast and doesn’t require much memory to manage several thousands of classes, see benchmark. BOUML is extensible, and the external tools named plug-outs can be written in C++ or Java, using BOUML for their definition as any other program. The code generators, reverses and roundtrips are ones of the pre-defined plug-outs included in the BOUML distribution. See features.

FEATURES

  • is extremely fast (fastest UML tool ever created, check out benchmarks),
  • has rock solid PHP import and export support (also supports C++, Java, Python)
  • is multiplatform (Linux, Windows, other OSes),
  • is full featured, impressively intensively developed (look at development history, it’s hard to believe – that such fast progress is possible).
  • supports plugins, has modular architecture (this allows user contributions, looks like BOUML community is forming up)
    https://www.bouml.fr/

Sparx Systems Enterprise Architect
The best (Windows) software i have found to do PHP and UML is Sparx Systems Enterprise Architect. not free ($199), but definitely worth the money.besides a pletora of features, it supports the following for PHP:

FEATURES

  • Reverse engineer object oriented PHP into UML class diagrams
  • Generate PHP class definitions from UML class diagrams
  • Synchronize changes made in a UML class into the corresponding PHP class definition
  • Synchronize changes made in a PHP class definition into the corresponding UML class
  • Create UML sequence diagrams to show what PHP classes use and how they are used
  • Produce detailed documentation of your PHP code in standard RTF and HTML format
  • Perform code engineering on models to generate base PHP pages.

AutoDia
AutoDia is a modular application that parses source code, XML or data and produces an XML document in Dia format (or images via graphviz and vcg). Its goal is to be a UML / DB Schema diagram autocreation package. The diagrams its creates are standard UML diagrams showing dependancies, superclasses, packages, classes and inheritances, as well as the methods, etc of each class.

Graphviz
Graphviz is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics, software engineering, database and web design, machine learning, and in visual interfaces for other technical domains.
Graphviz (using dot to generate jpg, png, etc)

FEATURES

  • dot vcg
  • xvcg (using xvcg to output postscript, etc)
  • dia (using a new custom directed graph algorithm to layout diagrams)
  • HTML/XML/Anything (if you write your own template)
  • Experimental SpringGraph (native perl directed graphs similar to graphviz) now included
  • Experimental Umbrello XML/XMI (requires fixing)
  • Autodia now parses the following forms of input
Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)