{"id":13593498,"url":"https://github.com/jhofm/ph-puml","last_synced_at":"2026-01-14T00:03:26.882Z","repository":{"id":55388225,"uuid":"322569986","full_name":"jhofm/ph-puml","owner":"jhofm","description":"PlantUML class diagram generator for PHP code","archived":false,"fork":false,"pushed_at":"2022-12-29T18:15:16.000Z","size":267,"stargazers_count":27,"open_issues_count":22,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-26T08:40:01.729Z","etag":null,"topics":["architecture","class-diagram","code-quality","generator","php","plantuml","plantuml-diagrams","plantuml-generator","uml","uml-diagram"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jhofm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-18T11:02:17.000Z","updated_at":"2025-08-27T12:25:41.000Z","dependencies_parsed_at":"2023-01-31T09:31:43.621Z","dependency_job_id":null,"html_url":"https://github.com/jhofm/ph-puml","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/jhofm/ph-puml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhofm%2Fph-puml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhofm%2Fph-puml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhofm%2Fph-puml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhofm%2Fph-puml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhofm","download_url":"https://codeload.github.com/jhofm/ph-puml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhofm%2Fph-puml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406469,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architecture","class-diagram","code-quality","generator","php","plantuml","plantuml-diagrams","plantuml-generator","uml","uml-diagram"],"created_at":"2024-08-01T16:01:20.897Z","updated_at":"2026-01-14T00:03:26.865Z","avatar_url":"https://github.com/jhofm.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# PhPuml\n\n[![Packagist](https://img.shields.io/packagist/l/jhofm/ph-puml.svg?style=flat-square)](https://packagist.org/packages/jhofm/ph-puml)\n[![Packagist](https://img.shields.io/packagist/v/jhofm/ph-puml.svg?style=flat-square)](https://packagist.org/packages/jhofm/ph-puml)\n[![Packagist](https://img.shields.io/packagist/php-v/jhofm/ph-puml.svg?style=flat-square)](https://packagist.org/packages/jhofm/ph-puml)\n[![CI Workflow](https://img.shields.io/github/workflow/status/jhofm/ph-puml/CI.svg?style=flat-square)](https://github.com/jhofm/ph-puml/actions)\n\n\n## About PhPuml\n\nPhPuml generates PlantUML class diagrams from PHP code.\n\nHere's a class diagram of the tool, created by itself:\n\n![PhPuml class diagram](./doc/img/ph-puml.svg)\n\n## Features\n\n * Convenient installation via composer\n * Generate PlantUml files without having PlantUML installed or generate all supported formats (png, svg, latex, etc) using a `plantuml.jar` executable\n * Packages from Namespaces\n * Generates inheritance relationships for classes, interfaces and traits\n * Generates class properties \u0026 method signatures, including type hints from @var doc comments\n * Dependencies are inferred from constructor argument types (assumes dependency injection)\n * Associations are inferred from \"new\" expressions (\\\u003c\\\u003ccreates\\\u003e\\\u003e) and \"throw\" statements (\\\u003c\\\u003cthrows\\\u003e\\\u003e)\n * Types renderable with fully qualified or short names (independently configurable for interfaces, traits, classes, properties and method arguments)   \n * Works on Linux (tested), Windows (tested), macOS (probably)\n\n## Installation\n\nThe easiest way to install PhPuml is as a composer project.\n\n```bash\n$ composer create-project jhofm/ph-puml\n```\n\nA [phar](https://www.php.net/manual/en/book.phar.php) version of the tool is created a part of the build process, but currently not reliably downloadable. However with the project already installed,\nyou can create the phar yourself using [clue/phar-composer](https://github.com/clue/phar-composer).  \n```bash\n$ curl -JL -o phar-composer.phar https://clue.engineering/phar-composer-latest.phar\n$ php phar-composer.phar ph-puml\n$ php ph-puml.phar\n```\n\n## Quick Start\n\nThe `ph-puml` script will output PlantUML syntax describing all PHP files found in the current folder when run without any parameters. \n\n```bash\n$ cd mycode/src\n$ ph-puml \n```\n\nYou can specify a relative or absolute path to a target directory or file as the first argument.\n\n```bash\n$ ph-puml mycode/src\n```\n\nThe second optional argument is the output path. The console's standard output will be used if none is specified.\n\nThe following two commands produce the same result:\n```bash\n$ ph-puml mycode/src \u003e class.puml\n$ ph-puml mycode/src class.puml\n```\n\n## Advanced features\n\n### Output formats\n\nPhPuml generates PlantUML puml file syntax by default, but you can also export most output formats supported by PlantUML directly.\n\nCurrently, these are:\n - eps (Postscript)\n - latex (LaTeX/Tikz)\n - latex:nopreamble (LaTeX/Tikz without preamble)\n - png (PNG image)\n - svg (SVG vector image)\n - scxml (SCXML state chart, seems broken in PlantUML Version 1.2020.26)\n - txt (ASCII art)\n - utxt (ASCII art with unicode letters)\n - vdx (VDX image)\n - xmi (XMI metadata description)\n\nThis requires a Java Runtime Environment on the machine running PhPuml. See the [PlantUML guide](https://plantuml.com/starting) for more information.\nYou also need to either:\n\n- provide a path to a `plantuml.jar` file\n\n```bash\n$ ph-puml /my/code/dir -p /somedir/plantuml.jar -f svg \u003e ~/mycode.svg\n```\n\n - or install the optional [jawira/plantuml](https://packagist.org/packages/jawira/plantuml) package\n\n```bash\n$ composer create-project jhofm/ph-puml\n$ cd ph-puml\n$ composer require jawira/plantuml\n$ ph-puml /my/code/dir -f svg \u003e ~/mycode.svg\n```\n\n### Path filters\n\nIf the input path is a directory, PhPuml will determine the code files to analyze using a set of inclusion and exclusion rules.\nBy default, files in the directory tree with the file extension `.php` are included, as long as none of their parent folders are called `vendor`.\n \nYou can override the filter rules with command line options. All rules are regular expressions. You can use several at the same time.\nFor example the following command will NOT skip files from `vendor` folders, and analyze files in the `includes` folder with the file extension `.inc` as well.  \n\n```bash\n$ ph-puml -e -i \"/\\.php$/\" -i \"/^includes/.*\\.inc$/\"\n```\n\nThe command will fail when attempting to parse files that do not contain valid PHP code.\n\n### Namespaces\n\nNamespaced classes, interfaces and traits are rendered with fully qualified names by default, while property and method argument types are not. \nThis behaviour can be customized using the `namespaced-types`/`t` option.\n\n```bash\n$ ph-puml -t cmp # render all types as FQNs\n$ ph-puml -t # render short types only\n$ ph-puml -t c # render only classlikes (classes, interfaces \u0026 traits) as FQNs  \n```\n\n### Relations to external types\n\nRelations to types that have not been analyzed are not rendered by default to reduce clutter in the generated diagram.\nThis included built-in Types like \\Exception etc. Add the following option to include these relations. \n\n```bash\n$ ph-puml -x false # include relations to types that were not analyzed\n```\n\n### Help   \nPhPuml uses `symfony/command`, so a help page including all supported arguments and options is available.   \n\n```bash\n$ ph-puml -h\n```\n\nOmitting namespaces for classes, interfaces or traits may cause relations to be drawn wrong if unqualified type names are repeated in the analyzed sources.\n\n## Limitations\n\n* Auto generated class diagrams will probably never exactly meet your needs, but provide a starting point for manual refinement (and save mind-numbing work).\n* PhPuml is able to handle huge amounts of code files, but limiting diagrams to as few classes as needed is always good idea.\n* Cleaner code will yield better results. Type hints and Namespaces help a whole lot, for example.\n* There's a lot of polishing still to be done, like inferring additional relation types or providing more customisations. \n\n## Troubleshooting\n\n* `Uncaught Error: Class Composer\\InstalledVersions not found`: PhPuml requires Composer 2\n* `require(): Failed opening required ...`: Run composer install \n\n## Acknowledgements\n\nThis would have been exponentially more difficult to do without [Nikita Popov](https://github.com/nikic)'s [PHP-Parser](https://github.com/nikic/PHP-Parser),\nso many thanks for that. [Symfony](https://github.com/symfony) helped a lot, too. \nBasically every dependency i use is maintained by kings, queens and total legends. \u003c3  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhofm%2Fph-puml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhofm%2Fph-puml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhofm%2Fph-puml/lists"}