- How do I install jawira/plantuml-to-image in a Laravel project?
- Install it with Composer using composer require jawira/plantuml-to-image. Because the package wraps the PlantUML jar, make sure Java and a PlantUML jar are available in your environment. In Laravel, check the package README for any service provider, facade, or configuration publishing steps, since those details depend on the release you install.
- Does jawira/plantuml-to-image require Java or the PlantUML jar to be installed?
- Yes, the package is a wrapper around the PlantUML jar, so it needs a Java runtime and access to a PlantUML jar file. It does not reimplement PlantUML rendering in PHP. Confirm the required Java and jar versions in the package documentation for your release.
- Which image formats can I generate from PlantUML diagrams?
- The package can produce PNG, SVG, and other image formats supported by PlantUML. The exact list depends on the PlantUML jar version you use. Check the wrapper options and PlantUML documentation for format-specific behavior.
- How do I convert a .puml file to an image in PHP?
- Use the package wrapper to point at your .puml source, select the desired output format, and run the conversion. The wrapper handles invoking the PlantUML jar and writing the generated image. See the README for the exact class names and method calls for your installed version.
- Can I use jawira/plantuml-to-image outside Laravel?
- Yes, it is a PHP package that wraps PlantUML and does not require Laravel. You can use it in plain PHP applications, CLI tools, or other frameworks. Laravel-specific integration is optional and depends on the package version.
- How do I set the PlantUML jar path or Java binary path?
- You normally provide the location of the PlantUML jar and, if needed, the Java executable through the package configuration or the wrapper constructor. The exact option names depend on the installed version, so confirm them in the README or source. Use absolute paths and verify the web server user can read the jar and execute Java.
- Is jawira/plantuml-to-image suitable for generating diagrams at runtime in production?
- It can work in production, but each conversion may start a Java process, so cache generated images and avoid converting the same diagram repeatedly. Treat .puml input as code: restrict who can submit diagrams and disable unsafe PlantUML features where possible. Monitor process timeouts and memory limits for large diagrams.
- How can I test PlantUML image generation in a Laravel application?
- Create a small fixture .puml file and run the wrapper in a test that asserts the expected image file is created and has the correct MIME type or signature. In Laravel, you can use the filesystem fake or a temporary directory to avoid writing to real storage. If tests must run without Java, mock the wrapper layer or skip integration tests and cover your own diagram-generation service separately.
- What are alternatives to jawira/plantuml-to-image for Laravel?
- Alternatives include calling the PlantUML jar directly with Symfony Process, using another PlantUML PHP wrapper, or sending diagrams to a PlantUML server. Each option trades local Java dependency and control against network dependency and privacy. For Laravel, choose based on whether you need local rendering, queued jobs, or remote rendering.
- Which PHP and Laravel versions does jawira/plantuml-to-image support?
- The package's supported PHP and Laravel versions are defined in its composer.json, and the README may list tested framework versions. Check those constraints before installing in an older Laravel app. If your Laravel version is not listed, test the wrapper in a staging branch or use a more actively maintained alternative.