phuml
phuml copied to clipboard
ParserAbstract error whn trying to generate a diagram (on docker)
I can't get phuml on docker to work, I haven't tried with Composer or Phive. It was working last time I tried some months ago. I tried the examples on the docs page and also tried editing it without any success
docker run --rm -v $PWD:/code montealegreluis/phuml phuml:diagram -p dot -r -a src UML.png
[|] Running... (This may take some time)
[|] Parsing codebase structure
In ParserAbstract.php line 318:
Syntax error, unexpected T_STRING, expecting T_VARIABLE on line 7
phuml:diagram [-p|--processor PROCESSOR] [-r|--recursive] [-a|--associations] [-i|--hide-private] [-o|--hide-protected] [-m|--hide-methods] [-t|--hide-attributes] [-b|--hide-empty-blocks] [-e|--theme [THEME]] [--] <directory> <output>
I get the same error
Hello, I have been utilizing phuml
on Docker as well and it is working sucessfully.
I would ask for the image version that you was using at that time but at least the image tagged latest
works for my experiments, I used it on a dummy project with 4 classes only.
As info. the image tagged 6.1.0
is non-working correctly, as a non-expert on PHP I think that is an error with the source code used on that tag.
I'll expose a demonstration about how I use the tool on a pretty straighforward project and the results that I got.
Project structure and files
./
.docker/ --> Bridge for containerization logic.
└── compose.yaml
src/ --> App logic.
└── Leaf
├── LeafHandler.php --> Use Repository logic.
├── LeafHandlerInterface.php
└── Repository
├── LeafRepository.php
└── LeafRepositoryInterface.php
uml/ --> Directory where to store artifacts.
For my purposes I have to use a docker compose
scheme in order to orchestrate this service with some others required.
# .docker/compose.yaml
services:
# Some other services before this line.
uml:
image: montealegreluis/phuml:latest
volumes:
- ./../:/code
- ./../uml:/uml
Hands on
After observing the documentation and the "layers" that x
image have on it the next
docker commands helps my to achieve my needs.
docker compose -f .docker/compose.yaml build
To execute the phuml
services I do it in this way, feel free to observe the documentation in order to understand the command and set of arguments.
docker compose -f .docker/compose.yaml run --rm uml phuml:diagram -r -a -i -o -p dot src/ uml/example.png
Results
After observe the uml/
directory I have the next image:
Expected for me ofc! ⚽️
References
- https://montealegreluis.com/phuml/docs/class-diagram.html
- https://hub.docker.com/layers/montealegreluis/phuml/latest/images/sha256-ed5caaa36c8c9742c72b70d71d5f0b159b031417229a88a2b7d66f2ba1e13efa?context=explore
- https://dasunhegoda.com/class-diagram-from-php-code-using-phuml/867/
I didn't review the final reference, but seems ok for me share the blog related with this tool and how the autor use it.
Hello @MontealegreLuis
Maybe you could review this issue and close it, assuming that there is an incomplete evidence from the author and the project have at least a Docker image working (I did not try all of them).
I can confirm this error. It may be due to using phUML docker image on a PHP 8.2 code base.
I can confirm this error. I am also using PHP 8.2.