PHPのソースコードからクラス図をリバースエンジニアリングするphp-class-diagram を Packagist に公開しました

php-class-diagram を Packagist に公開しました。(Packagistデビュー)

smeghead/php-class-diagram

composerでインストールできるようになりました。

composer require --dev smeghead/php-class-diagram

ログ

初めての自家製パッケージをcomposerからインストールしたので記録しておきます。

  • インストール
$ composer require --dev smeghead/php-class-diagram
Using version ^0.0.0 for smeghead/php-class-diagram
./composer.json has been updated
Running composer update smeghead/php-class-diagram
Loading composer repositories with package information
Updating dependencies
Lock file operations: 4 installs, 0 updates, 0 removals
  - Locking nikic/php-parser (v4.13.1)
  - Locking smeghead/php-class-diagram (v0.0.0)
  - Locking symfony/finder (v5.3.7)
  - Locking symfony/polyfill-php80 (v1.23.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
  - Downloading symfony/polyfill-php80 (v1.23.1)
  - Downloading symfony/finder (v5.3.7)
  - Downloading nikic/php-parser (v4.13.1)
  - Downloading smeghead/php-class-diagram (v0.0.0)
  - Installing symfony/polyfill-php80 (v1.23.1): Extracting archive
  - Installing symfony/finder (v5.3.7): Extracting archive
  - Installing nikic/php-parser (v4.13.1): Extracting archive
  - Installing smeghead/php-class-diagram (v0.0.0): Extracting archive
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
  • ヘルプ表示
$ vendor/bin/php-class-diagram --help
usage: php-class-diagram [OPTIONS] <target php source directory>
 
A CLI tool that parses the PHP source directory and outputs PlantUML class diagram scripts.
 
OPTIONS
  -h, --help                     show this help page.
      --enable-class-properties  describe properties in class diagram.
      --disable-class-properties not describe properties in class diagram.
      --enable-class-methods     describe methods in class diagram.
      --disable-class-methods    not describe methods in class diagram.
      --php5                     parse php source file as php5.
      --php7                     parse php source file as php7.
      --php8                     parse php source file as php8. (not suppoted)
  • 実行
$ vendor/bin/php-class-diagram /usr/src/test/fixtures/namespace/
@startuml
  package "product" <<Rectangle>> {
    class Name
    class Price
    class Product
  }
  Product ..> Name
  Product ..> Price
@enduml

まだ、–version オプションもできていないので、v0.0.0 というバージョンで公開しました。 エラー表示の整備とか、リファクタリングとか、暫くはやることがあるな。

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.