{"id":24433841,"url":"https://github.com/windler/godepg","last_synced_at":"2026-03-11T08:35:03.319Z","repository":{"id":144211228,"uuid":"115655306","full_name":"windler/godepg","owner":"windler","description":"generates a dependency graph for a go or php project","archived":false,"fork":false,"pushed_at":"2018-02-11T20:15:59.000Z","size":2765,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T15:08:21.293Z","etag":null,"topics":["composer","custom-filter","dependencies","dependency-graph","generate","go","golang","graph","packages","php","psr4"],"latest_commit_sha":null,"homepage":"","language":"Go","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/windler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-28T19:58:34.000Z","updated_at":"2022-07-02T05:38:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"110253f7-be61-4bad-93a6-91dafd22a163","html_url":"https://github.com/windler/godepg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/windler/godepg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windler%2Fgodepg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windler%2Fgodepg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windler%2Fgodepg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windler%2Fgodepg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/windler","download_url":"https://codeload.github.com/windler/godepg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windler%2Fgodepg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30376309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: 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":["composer","custom-filter","dependencies","dependency-graph","generate","go","golang","graph","packages","php","psr4"],"created_at":"2025-01-20T16:50:57.225Z","updated_at":"2026-03-11T08:35:03.294Z","avatar_url":"https://github.com/windler.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/windler/godepg)](https://goreportcard.com/report/github.com/windler/godepg) [![CircleCI](https://circleci.com/gh/windler/godepg/tree/master.svg?style=svg)](https://circleci.com/gh/windler/godepg/tree/master) [![codebeat badge](https://codebeat.co/badges/e67e3f88-4c4f-4f1a-9a3c-b9aeaa84af96)](https://codebeat.co/projects/github-com-windler-godepg-master)\n# godepg\n`godepg` generates a dependency graph for a go or php project using `graphviz`. A dependency graph generated by `godepg` using a [config](godepg.yml) looks like the following:\n![godepg dep graph](deps.png)\n\nCurrently, the following technologies are supported:\n* go\n* php (composer)\n* php (psr4)\n\n## TOC\n\n1. [Prerequisites](#prerequisites)\n2. [Installation](#installation)\n3. [Usage](#usage)\n4. [Generate graphs](#generate-graph)\n5. [Examples](#examples)\n6. [Print dependencies](#print-dependencies)\n\n## Prerequisites\nIn order to generate graphs you have to install [graphviz](https://graphviz.gitlab.io/)\n## Installation\n```bash\ngo get github.com/windler/godepg\n``` \n\nMake sure that your `$GOROOT` is set and is present in your path\n```bash\nexport PATH=$PATH:$GOROOT/bin\n```\n\n## Usage\nFor each language there is a subcommand. Type `godepg \u003clanguage\u003e -h` to see a list of available options.\n\n### GO\n```bash\ngodepg go -h\n```\n\n```bash\nOPTIONS:\n   -o file, --output file         destination file to write png to\n   -p package, --package package  the package to analyze\n   -n, --no-go-packages           hide gos buildin packages\n   -d value, --depth value        limit the depth of the graph (default: -1)\n   -f value, --filter value       filter package name\n   -m, --my-packages-only         show only subpackages of scanned package\n   -i package, --info package     shows the dependencies for a package\n   --inverse                      shows all packages that depend on the package rather than its dependencies\n   --format value                 formats the dependencies output (--info)\n```\n\n### PHP (composer)\n```bash\ngodepg php-composer -h\n```\n\n```bash\nOPTIONS:\n   -o file, --output file         destination file to write png to\n   -p project, --project project  the project to analyze\n   -f value, --filter value       filter project name\n   -s value, --stop-at value      dont scan dependencies of package name (pattern)\n   -d value, --depth value        limit the depth of the graph (default: -1)\n```\n\n### PHP (psr4)\n```bash\ngodepg php-psr4 -h\n```\n\n```bash\nOPTIONS:\n   -o file     destination file to write png to\n   -p project  the project to analyze\n   -f value    filter project name\n   -s value    dont scan dependencies of package name (pattern)\n   -d value    limit the depth of the graph (default: -1)\n   -e value    exclude folder\n```\n\n## Generate graphs\nAll graphs are written to `~/godepg/\u003cpkg\u003e_timestamp.png` if option `-o` is not present. You can change the home directory by setting the env `GODEPG_HOME`.\n\n### Generate Graphs using yaml file\nWhen no language subcommand is specified, `godepg` will try to read a config file named `godepg.yml` to generate a dependy graph. You can also specify the config file with the option `--file`. Following, there is a sample config file:\n\n```yaml\nlanguage: php-composer\noutput: /home/windler/projects/sample/deps.png\nstopat:\n- laravel\nfilter:\n- php\n- tinker\ndepth: 3\n```\n\n### Styling graphs using config\nIf you are using a config file you can also apply any [dot attributes](https://graphviz.gitlab.io/_pages/doc/info/attrs.html) to style your graph. Example:\n```yaml\nlanguage: php-composer\noutput: /home/windler/projects/sample/deps.png\nfilter:\n- php\ndepth: 3\nedgestylepattern:\n  \"\":\n    arrowhead: open\n    color: white\n    fontcolor: white\n    splines: curved\n  sample:\n    arrowhead: vee\n    fontname: Courier\n    style: dashed\nnodestyle:\n  fillcolor: \"#336699\" \n  style: filled\n  fontcolor: white\n  fontname: Courier\n  shape: rectangle\ngraphstyle:\n  bgcolor: \"#333333\"\n```\n\nAfter creating a config file, you can always update your current dependy graph using\n```bash\ncd /home/windler/projects/sample\ngodepg \n```\nor\n```bash\ngodepg --file /home/windler/projects/sample/godepg.yml\n```\n\n### Available attributes\n\n| Attribute | Type | Language | Description |\n|--|--|--|--|\n| language | string | all | the language to use |\n|\tfilter | array | all | filters node names (hide) |\n| depth | int | all | max depth of the graph |\n| output | string | all | output file of the png (and dot file) |\n|\tedgestylepattern | map string -\u003e (map string -\u003e string) | all | apply dot attributes to edges. The first map key is a pattern on which nodes the attributes should be applied. If all nodes should be applied use `\"\"`. |\n|\tedgestyle | map string -\u003e string | all | apply edge attributes |\n|\tnodestyle | map string -\u003e string | all | apply node attributes |\n|\tgraphstyle | map string -\u003e string | all | apply graph attributes |\n|\tproject | string | php | the project the use (relative to wd) |\n|\texclude | array | php | folders to ignore |\n|\tstopat | array | php | print node but dont scan/print dependencies |\n|\tpackage | string | go | package name to scan |\n|\tnogopackages | bool | go | hide go packges in graph |\n| mypackagesonly | bool | go | only show subpackages of the scanned package |\n\n## Examples\nFollowing, you can find sample outputs.\n\n### GO\nSamples for the [ws package](https://github.com/windler/ws) package.\n\n#### Without go internal packages and specific output file\n```bash\ngodepg go -p github.com/windler/ws -o ~/ws_package.png -n\n```\nor\n\n```bash\ncd /user/windler/go/src/github.com/windler/ws\ngodepg go -p . -o ~/ws_package.png -n\n```\n![ws no go packages](images/ws_no_go_pkgs.png)\n\n#### Only sub packages\n```bash\ngodepg go -p github.com/windler/ws -m\n```\n![ws only sub](images/ws_my_only.png)\n\n#### Without go internal packages and custom filter\n```bash\ngodepg go -p github.com/windler/ws -n -f=ui -f=/git\n```\n![ws custom filter](images/ws_custom_filter.png)\n\n### PHP\nSamples for a fresh [Laravel](https://github.com/laravel/laravel) installation called `sample`.\n\n#### Dont show laravels dependencies\n```(bash)\ngodepg php-composer -p /home/windler/projects/sample -s=laravel\n```\n![rpi no laravel](images/sample_no_lara.png)\n\n#### Hide symfony dependecies\n```(bash)\ngodepg php-composer -p /home/windler/projects/sample -f=symfony\n```\n![rpi no laravel](images/sample_no_symf.png)\n\n\n## Print dependencies (GO only)\nYou can also just print information about the dependencies of a package by using option `-i`:\n```(bash)\ngodepg go -p github.com/windler/ws -i github.com/windler/ws/app/config\nThere are 7 dependencies for package github.com/windler/ws/app/config:\n\n0: github.com/windler/ws/app/commands\n1: gopkg.in/yaml.v2\n2: io/ioutil\n3: log\n4: os\n5: os/user\n6: strings\n```\n\n### Get Dependents\n\nIf you would like to see a list of packages that depend on a specific package, just add the `--inverse` option:\n```(bash)\ngodepg go -p github.com/windler/ws -i github.com/windler/ws/app/config --inverse\nThere are 1 dependents for package github.com/windler/ws/app/config:\n\n0: github.com/windler/ws\n```\n\n### Modify output\nYou can modify the output by passing a [`template`](https://golang.org/pkg/html/template/) using `--format`: \n```(bash)\ngodepg go -p github.com/windler/ws -i github.com/windler/ws --format \"Deps: {{.Count}}\"\nDeps: 5\n```\n\nYou can use the following fields:\n\n| Field          | Description                                        |\n|----------------|----------------------------------------------------|\n| Package        | The name of the scanned package                    |\n| Count          | Number of found dependencies                       |\n| Dependencies   | Array of packages                                  |\n| DependencyType | Type of the dependencies (dependency or dependent) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindler%2Fgodepg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwindler%2Fgodepg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindler%2Fgodepg/lists"}