clue / graph-composer Goto Github PK
View Code? Open in Web Editor NEWDependency graph visualization for composer.json (PHP + Composer)
Home Page: https://clue.engineering/2020/introducing-graph-composer
License: MIT License
Dependency graph visualization for composer.json (PHP + Composer)
Home Page: https://clue.engineering/2020/introducing-graph-composer
License: MIT License
I am getting an error that says:
In GraphViz.php line 206:
Unable to invoke "dot" to create image file (code 127)
the requirement is one issue .. but the fact it gives no information if the command is not available is the bigger issue.
Add a self-update command to the graph-composer.phar
.
Possibly related:
I get this error:
Unable to invoke "dot" to create image file (code 127)
I have installed the graphviz, I have tried to reinstall it again, but I still get the same error.
Using Yii2, controller action:
public function actionGraph()
{
$dir = Yii::getAlias('@app') . '/vendor';
$graphComposer = new \Clue\GraphComposer\Graph\GraphComposer($dir);
$graph = $graphComposer->createGraph();
$graphviz = new \Graphp\GraphViz\GraphViz();
$graphviz->setFormat('svg');
$svg = $graphviz->createImageFile($graph);
return $this->render('graph', ['svg' => $svg]);
}
and view:
<?php
/**
* @var $this yii\web\View
* @var $svg string
*/
var_dump($svg);
use yii\helpers\Html;
$this->title = 'Dependency Graph';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-dependency-graph">
<h1><?= Html::encode($this->title) ?></h1><br />
<div id="graph-placeholder">
<!-- place here the svg file -->
<?= $svg ?>
</div>
</div>
Add an option to export the graph with links, similar to http://godoc.org/github.com/docker/docker/api/client?import-graph
Please update symfony console dependency:
"symfony/console": "^2.1|^3.0",
When installed over composer global require clue/graph-composer
after trying to to run graph-composer
it says:
ERROR: Composer not properly set up! Run "composer install" or see README.md for more details
Ran this to install:
composer require --dev clue/graph-composer
Tried this but there is no vendor/bin folder even:
./vendor/bin/graph-composer show
Tried this but get error message:
./vendor/clue/graph-composer/bin/graph-composer show
sh: dot: command not found
[Fhaculty\Graph\Exception\UnexpectedValueException]
Unable to invoke "dot" to create image file (code 127)
Need to update installation directions to require dot even if installing via composer.
Also fix or update installation directions for the vendor/bin problem.
Some projects have many dependencies and the graphs can get too large (#11). One option would be to add a --depth
option in order to limit the depth of the resulting graph.
For example, the following could be used to display only direct dependencies (i.e. no sub-dependencies):
$ graph-composer show --depth=1
Special care may have to be taken with regards to loops/circles in the graph.
The current behavior is to also visualize development dependencies. This should be changed to ignore them by default and add a new --dev
argument flag which enables showing development dependencies.
Error:
Composer not properly set up! Run "composer install" or see README.md for more details
The default exported image is from up to down. So, when the dependence packages go large, the width of the image goes wide.
I think it would be better to make it left to right (Or you can do an option), at least as a tree, the depth wouldn't go so far. It is more convenience to scroll from up to down than scroll left to right...
( :) a lot of directions may not confuse you )
$ graph-composer export directory -
Actually exporting to GraphML should be implemented in graphp/graph#3.
This ticket serves both as a valid use case for its implementation and as a reminder to add the necessary glue code to take advantage of it within this project.
Currently, generating a graph image just fails if GraphViz (dot
executable) is not installed. Instead, we should check for the existence and fail gracefully with a concise, readable error message. On Debian-based systems, we could perhaps also offer to install it via sudo apt-get install graphviz
.
Ex.:
graph-composer . --package clue/graph-composer
If current project has several dependencies
The following deprecation notices are generated when I run the latest release on PHP 8.1
php graph-composer-1.1.0.phar export ./
[12-Sep-2022 07:56:11 UTC] PHP Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php on line 104
Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php on line 104
[12-Sep-2022 07:56:11 UTC] PHP Deprecated: Return type of Fhaculty\Graph\Set\Vertices::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Vertices.php on line 414
Deprecated: Return type of Fhaculty\Graph\Set\Vertices::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Vertices.php on line 414
[12-Sep-2022 07:56:11 UTC] PHP Deprecated: Return type of Fhaculty\Graph\Set\Vertices::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Vertices.php on line 451
Deprecated: Return type of Fhaculty\Graph\Set\Vertices::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Vertices.php on line 451
[12-Sep-2022 07:56:11 UTC] PHP Deprecated: Return type of Fhaculty\Graph\Set\Edges::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Edges.php on line 386
Deprecated: Return type of Fhaculty\Graph\Set\Edges::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Edges.php on line 386
[12-Sep-2022 07:56:11 UTC] PHP Deprecated: Return type of Fhaculty\Graph\Set\Edges::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Edges.php on line 412
Deprecated: Return type of Fhaculty\Graph\Set\Edges::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Edges.php on line 412
Looks like composer build
is not compatible with composer v2.
$ composer build
[1/1] Creating phar graph-composer-1.1.0-5-g25ea081.phar
- Adding main package "clue/graph-composer"
- Adding composer base files
Catchable fatal error: Argument 1 passed to Clue\PharComposer\Package\Package::__construct() must be of the type array, boolean given, called in /root/graph-composer/vendor/clue/phar-composer/src/Clue/PharComposer/Phar/PharComposer.php on line 136 and defined in /root/graph-composer/vendor/clue/phar-composer/src/Clue/PharComposer/Package/Package.php on line 21
Script @php build.php handling the build event returned with error code 255
Build still works fine however in composer v1 (now deprecated). I noticed this when attempting to containerize this (see https://github.com/patricknelson/graph-composer-docker).
Step to reproduce:
# Get graph-composer-docker repository and work from the 'composer-2' branch
git clone [email protected]:patricknelson/graph-composer-docker.git
cd graph-composer-docker
git checkout composer-2
# Tries to build container, but will fail
docker-compose up -d --build
Basically, what the Dockerfile
does:
composer build
(and fails)EDIT: You can see the diff in Dockerfile now in this PR: patricknelson/graph-composer-docker#1
My graph is just to large. I want to use it for documentation purposes and don't want to show up third party graph-nodes.
So a regular expression filter would help me here.
Would you merge this?
Best regards
Philipp
Use http://home.mircad.nl/md/Dot_image_map.html to optionally allow an image map to be exported with the same name as the image file to make the nodes in the image clickable. When clicked, the link should go to packagist.org/packages/org-name/package-name.
wget https://github.com/clue/graph-composer/releases/download/v1.0.0/graph-composer.phar
php graph-composer.phar --version
Output:
graph-composer version @git_tag@
Expected:
graph-composer version 1.0.0
Hi,
Why I can read just "_root" in export.png ?
Thank you
@wol-soft has implemented an up-to-date check based on #45 in wol-soft#1 which colorizes the graph.
Colorized graphs work like:
Originally posted by @wol-soft in #45 (comment)
There seems to be a issue with packages with non lowercase package names.
Example:
http://hhvm.h4cc.de/graphs/laravel_4_1.png
The package jeremeamia/SuperClosure has two nodes, one in mixed case and the other in lowercase.
I created the following dockerfile to test this project
FROM alpine:3.13
RUN apk add --no-cache curl
WORKDIR /app
RUN curl -o graph-composer -L https://clue.engineering/graph-composer-latest.phar && chmod +x graph-composer
FROM php:8.0-cli-alpine
COPY --from=0 /app/graph-composer /usr/local/bin/graph-composer
RUN sed -i '/edge/s/^#//' /etc/apk/repositories \
&& apk add --no-cache graphviz
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/graph-composer"]
Would you be interested in connecting it to your project in any way ? It can of course be modified.
The current steps to build and deploy a new graph-composer.phar
are:
php box.phar build
to generate a new graph-composer-{version}.phar
Obviously, this should be automated. Possible solutions:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.