- 1. 概要
- 2. 初期化
- 3. インストール
- 4. 参考サイト
1. 概要
実は、前節でインストールした「PHP Universal Feed Generator」のドキュメントを抜き出したかったのです。
が、それは昔の話。
今は、「Laravel」の内部モジュールのドキュメントが欲しかったもので・・・。
「FreeBSD」では、「ports」「pkg」も存在しますが。
どうもそれは古いようです。
「composer」を使うのがよろしいようで。
2. 初期化
自分のローカルに、「phpDocumentor」用のプロジェクトを作成します。
cd
mkdir -pv phpdoc
初期化。
cd ~/phpdoc
composer init
Welcome to the Composer config generator
This command will guide you through creating your composer.json config.
Package name (<vendor>/<name>) [hogehoge/phpdoc]:
Description []:
Author [n to skip]: n
Minimum Stability []:
Package Type (e.g. library, project, metapackage, composer-plugin) []:
License []:
Define your dependencies.
Would you like to define your dependencies (require) interactively [yes]?
Search for a package:
Would you like to define your dev dependencies (require-dev) interactively [yes]?
Search for a package:
Add PSR-4 autoload mapping? Maps namespace "Hogehoge\Phpdoc" to the entered relative path. [src/, n to skip]:
{
"name": "hogehoge/phpdoc",
"autoload": {
"psr-4": {
"Hogehoge\\Phpdoc\\": "src/"
}
},
"require": {}
}
Do you confirm generation [yes]?
Composer could not detect the root package (hogehoge/phpdoc) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Generating autoload files
Generated autoload files
PSR-4 autoloading configured. Use "namespace Hogehoge\Phpdoc;" in src/
Include the Composer autoloader with: require 'vendor/autoload.php';
「Author [n to skip]:」の行だけ、n を入力。
他は、すべて Enter で答えています。
なにかあれば、後で編集すればいいので。
3. インストール
同じディレクトリで。
composer require --dev phpdocumentor/phpdocumentor
Composer could not detect the root package (hogehoge/phpdoc) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Generating autoload files
Generated autoload files
PSR-4 autoloading configured. Use "namespace Hogehoge\Phpdoc;" in src/
Include the Composer autoloader with: require 'vendor/autoload.php';
hogehoge@nt.sing.ne.jp /home/hogehoge/phpdoc $ composer require --dev phpdocumentor/phpdocumentor
Composer could not detect the root package (hogehoge/phpdoc) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
./composer.json has been updated
Composer could not detect the root package (hogehoge/phpdoc) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Running composer update phpdocumentor/phpdocumentor
Loading composer repositories with package information
Updating dependencies
Lock file operations: 75 installs, 0 updates, 0 removals
- Locking dflydev/dot-access-data (v3.0.3)
- Locking doctrine/deprecations (1.1.5)
- Locking doctrine/lexer (3.0.1)
・・・ 略 ・・・
- Locking symfony/yaml (v6.4.25)
- Locking twig/twig (v3.21.1)
- Locking webmozart/assert (1.11.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 75 installs, 0 updates, 0 removals
- Downloading doctrine/lexer (3.0.1)
- Downloading jawira/plantuml-encoding (v1.1.1)
- Downloading nette/utils (v4.0.8)
・・・ 略 ・・・
- Installing jean85/pretty-package-versions (2.1.1): Extracting archive
- Installing jawira/plantuml (v1.2025.7): Extracting archive
- Installing phpdocumentor/phpdocumentor (v3.8.1): Extracting archive
24 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
42 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^3.8 for phpdocumentor/phpdocumentor
今回は、不足するものがなかったようですが、不足している場合、「ports」か「pkg」でインストールする必要に迫られることもあります。
4. 参考サイト
本章は、下記のサイトおよび「ChatGPT」くんを参考にさせていただきました。
「phpDocumentor でドキュメント自動生成してみた」
|