1. Products
  2.   Diagram
  3.   PHP
  4.   PHP-PlantUMLWriter
 
  

Free PHP Library to Read, Write & Customize UML Diagrams

A Leading Open Source PHP UML Diagraming Library that allows Software Developers to Create, Edit, Manipulate and Export UML Diagrams from PHP Source.

What is PHP-PlantUMLWriter?

In the world of software development, visualizing complex systems and architectures is often a critical part of the design and documentation process. One tool that has gained popularity for this purpose is PlantUML, a text-based diagramming tool that generates diagrams from plain text descriptions. If you're a PHP developer looking for a convenient way to integrate PlantUML into your projects, the PHP library by David Fuhr is an excellent choice. Software developers can not only create and customize these diagrams using PHP code, but also making it easier to integrate diagram generation into your projects.

PHP-PlantUMLWriter is an open source PHP library that allows software developers to generate UML diagrams programmatically. The library can create a wide range of diagrams, including class diagrams, sequence diagrams, activity diagrams, and more. It abstracts the complexity of generating diagrams using PlantUML's text-based syntax and provides a simple, object-oriented interface for creating diagrams from within your PHP code. By incorporating the library into your projects, you can improve the documentation and communication of your software designs.

The PHP-PlantUMLWriter library is designed to be extensible. If you have specific requirements or need custom functionality, you can easily extend it to suit your needs. The library simplifies the process of generating PlantUML diagrams in your PHP applications. It's a valuable tool for PHP developers seeking to visualize and share complex system architectures, and it opens up new possibilities for creating well-documented, maintainable codebases. Whether you need to generate complex flowcharts, organizational charts, or network diagrams, the library simplifies the process.

Previous Next

Getting Started with PHP-PlantUMLWriter

The recommend way to install PHP-PlantUMLWriter is using Composer. Please use the following command for a smooth installation.

Install PHP-PlantUMLWriter via Composer

composer require davidfuhr/php-plantumlwriter
You can also download it directly from GibHub.

UML Diagrams Generating via PHP

The open source PHP-PlantUMLWriter library has include complete support for generating new PlantUML diagrams inside their PHP applications. Software developers can create a variety of diagrams supported, including class diagrams, sequence diagrams, use case diagrams, and more. The library allows to generates the PlantUML diagram text using the getDiagramText() method, which can then render into an actual diagram using a PlantUML renderer. The following example can be used to create a simple class diagram with two classes, "Car" and "Engine," and establish an association between them

How to Create PlantUML Diagram using PHP Library?

use PlantUmlWriter\PlantUmlWriter;

$plantUml = new PlantUmlWriter();

$plantUml->startDiagram();
$plantUml->addClass('Car');
$plantUml->addClass('Engine');
$plantUml->addAssociation('Car', 'Engine');
$plantUml->endDiagram();

echo $plantUml->getDiagramText();

Customizing Diagrams via PHP Library

The open source PHP-PlantUMLWriter library enables software developers to load and customize an existing diagram inside PHP applications. The library offers a wide range of customization options for your diagrams. You can set properties for classes, change the layout, add notes, and more. Here's an example that demonstrates how software developers customize a class in a diagram with just a couple of lines of PHP code.

How to Customize Diagrams using PHP Commands?

$plantUml->addClass('Person', ['abstract', '<>']);
$plantUml->addProperty('Person', '+name: string');
$plantUml->addMethod('Person', '+getName(): string');

Ease of Use & Integration Support

One of the PHP-PlantUMLWriter library's primary goals is to make it easy for software developers to create PlantUML diagrams without needing to write PlantUML syntax directly. Using the library, you can define diagrams using a clean and intuitive API. Morover, the library is designed to be extensible. If you have specific requirements or need custom functionality, the library can be easily extended to suit that particular need.

 English