오늘 github 를 돌아 다니다가 컴포저의 의존성을 graph 로 그려주는 grapth composer 라는 유용한 php 유틸리티를 발견했다.

 

composer.json 이 있는 폴더에서 실행하면 현재 프로젝트의 의존성을 그래프로 그려준다. 

 

설치

  1. wget 으로 다운로드 받는다.

    wget http://www.lueck.tv/graph-composer/graph-composer.phar
    CODE
  2. 리눅스일 경우 graph-composer.phar 에 /usr/local/bin 에 옮겨 놓고 실행 속성을 부여한다.

    chmod graph-composer.phar
    mv graph-composer.phar /usr/local/bin/graph-composer
    CODE
  3. 윈도우라면 graph-composer.phar 이 있는 폴더에 다음 내용을 graph-composer.bat 로 작성한다.

    @ECHO OFF
    php "%~dp0graph-composer.phar" %* 
    CODE
  4. cmd.exe 나 쉘에서 graph-composer 를 쳐서 다음과 같은 화면이 나오는지 확인한다.

    graph-composer version @git_tag@
    Usage:
      [options] command [arguments]
    Options:
      --help           -h Display this help message.
      --quiet          -q Do not output any message.
      --verbose        -v Increase verbosity of messages.
      --version        -V Display this application version.
      --ansi              Force ANSI output.
      --no-ansi           Disable ANSI output.
      --no-interaction -n Do not ask any interactive question.
    Available commands:
      export   Export dependency graph image for given project directory
      help     Displays help for a command
      list     Lists commands
      show     Show dependency graph image for given project directory
    CODE
  5. SVG 를 그려주는 GraphViz( http://www.graphviz.org/Download_windows.php) 를 다운받아서 압축을 해제하고 bin 폴더를 PATH 에 등록한다.
  6. dot.exe 가 실행되면 준비가 끝난다.

사용

composer.json 이 있는 폴더에서 다음 명령어를 실행한다.

graph-composer show
CODE

 

다음은 PHP 에서 JIRA 에 연결할 수 있는 php-jira-rest-client 프로젝트를 그래프로 그린 것이다.

php-jira-rest-client.svg