clue/graph-composer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

clue/graph-composer

Composer 安装命令:

composer require clue/graph-composer

包简介

Dependency graph visualization for composer.json

README 文档

README

CI status downloads on GitHub installs on Packagist

Graph visualization for your project's composer.json and its dependencies:

dependency graph for clue/graph-composer

Table of contents

Usage

Once clue/graph-composer is installed, you can use it via command line like this.

graph-composer show

The show command creates a dependency graph for the given project path and opens the default desktop image viewer for you:

$ php graph-composer.phar show ~/path/to/your/project
  • It accepts an optional argument which is the path to your project directory or composer.json file (defaults to checking the current directory for a composer.json file).

  • You may optionally pass an --format=[svg/svgz/png/jpeg/...] option to set the image type (defaults to svg).

graph-composer export

The export command works very much like the show command, but instead of opening your default image viewer, it will write the resulting graph to STDOUT or into an image file:

$ php graph-composer.phar export ~/path/to/your/project
  • It accepts an optional argument which is the path to your project directory or composer.json file (defaults to checking the current directory for a composer.json file).

  • It accepts an additional optional argument which is the path to write the resulting image to. Its file extension also sets the image format (unless you also explicitly pass the --format option). Example call:

    $ php graph-composer.phar export ~/path/to/your/project export.png

    If this argument is not given, it defaults to writing to STDOUT, which may be useful for scripting purposes:

    $ php graph-composer.phar export ~/path/to/your/project | base64
  • You may optionally pass an --format=[svg/svgz/png/jpeg/...] option to set the image type (defaults to svg).

Install

You can grab a copy of clue/graph-composer in either of the following ways.

This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 8+. It's highly recommended to use the latest supported PHP version for this project.

The graph drawing feature is powered by the excellent GraphViz software. This means you'll have to install GraphViz (dot executable). The Graphviz homepage includes complete installation instructions for most common platforms, users of Debian/Ubuntu-based distributions may simply invoke:

$ sudo apt install graphviz

As a phar (recommended)

Once you have PHP and GraphViz installed, you can simply download a pre-packaged and ready-to-use version of this project as a Phar to any directory. You can simply download the latest graph-composer.phar file from our releases page. The latest release can always be downloaded like this:

$ curl -JOL https://clue.engineering/graph-composer-latest.phar

That's it already. Once downloaded, you can verify everything works by running this:

$ cd ~/Downloads
$ php graph-composer.phar --version

If you prefer a global (system-wide) installation without having to type the .phar extension each time, you may simply invoke:

$ chmod +x graph-composer.phar
$ sudo mv graph-composer.phar /usr/local/bin/graph-composer

You can verify everything works by running:

$ graph-composer --version

There's no separate update procedure, simply download the latest release again and overwrite the existing phar.

Installation using Composer

Alternatively, you can also install clue/graph-composer as part of your development dependencies. You will likely want to use the require-dev section to exclude clue/graph-composer in your production environment.

This method also requires PHP 5.3+, GraphViz and, of course, Composer.

You can either modify your composer.json manually or run the following command to include the latest tagged release:

$ composer require --dev clue/graph-composer

Now you should be able to invoke the following command in your project root:

$ ./vendor/bin/graph-composer show

Alternatively, you can install this globally for your user by running:

$ composer global require clue/graph-composer

Now, assuming you have ~/.composer/vendor/bin in your path, you can invoke the following command:

$ graph-composer show ~/path/to/your/project

Note: You should only invoke and rely on the main graph-composer bin file. Installing this project as a non-dev dependency in order to use its source code as a library is not supported.

To update to the latest release, just run composer update clue/graph-composer. If you installed it globally via composer you can run composer global update clue/graph-composer instead.

Development

clue/graph-composer is an open-source project and encourages everybody to participate in its development. You're interested in checking out how clue/graph-composer works under the hood and/or want to contribute to the development of clue/graph-composer? Then this section is for you!

The recommended way to install clue/graph-composer is to clone (or download) this repository and use Composer to download its dependencies. Therefore you'll need PHP, Composer, GraphViz, git and curl installed. For example, on a recent Ubuntu/debian system, simply run:

$ sudo apt install php7.2-cli git curl graphviz

$ git clone https://github.com/clue/graph-composer.git
$ cd graph-composer

$ curl -s https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

$ composer install

You can now verify everything works by running clue/graph-composer like this:

$ php bin/graph-composer show

If you want to distribute clue/graph-composer as a single standalone release file, you may compile the project into a single graph-composer.phar file like this:

$ composer build

Note that compiling will temporarily install a copy of this project to the local build/ directory and install all non-development dependencies for distribution. This should only take a second or two if you've previously installed its dependencies already. The build script optionally accepts the version number (VERSION env) and an output file name or will otherwise try to look up the last release tag, such as graph-composer-1.0.0.phar.

You can now verify the resulting graph-composer.phar file works by running it like this:

$ ./graph-composer.phar --version

To update your development version to the latest version, just run this:

$ git pull
$ php composer.phar install

Made some changes to your local development version?

Make sure to let the world know! :shipit: We welcome PRs and would love to hear from you!

Happy hacking!

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

$ composer install

To run the test suite, go to the project root and run:

$ php vendor/bin/phpunit

License

This project is released under the permissive MIT license.

Did you know that I offer custom development services and issuing invoices for sponsorships of releases and for contributions? Contact me (@clue) for details.

clue/graph-composer 适用场景与选型建议

clue/graph-composer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 99.12k 次下载、GitHub Stars 达 938, 最近一次更新时间为 2013 年 05 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「dependency graph」 「visualize dependencies」 「visualize composer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 clue/graph-composer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 clue/graph-composer 我们能提供哪些服务?
定制开发 / 二次开发

基于 clue/graph-composer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 99.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 942
  • 点击次数: 11
  • 依赖项目数: 14
  • 推荐数: 0

GitHub 信息

  • Stars: 938
  • Watchers: 17
  • Forks: 58
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-05-17