Skip to content

Composer Source

The Composer source allows you to include source code from your project's Composer dependencies:

yaml
documents:  - description: Core Dependencies  outputPath: docs/core-dependencies.md  sources:  - type: composer  description: Core Dependencies  composerPath: .  packages:  - symfony/finder  - psr/log  filePattern: "*.php"  notPath:  - tests

Parameters

ParameterTypeDefaultDescription
typestringrequiredMust be "composer"
descriptionstring"Composer Packages"Human-readable description of the source
composerPathstring"."Path to composer.json file or directory containing it
packagesstring|array[]Package name pattern(s) to match
filePatternstring|array"*.php"File pattern(s) to match
notPatharray["tests", "vendor"]Patterns to exclude files
pathstring|array[]Patterns to include only files in specific paths
containsstring|array[]Patterns to include only files containing specific content
notContainsstring|array[]Patterns to exclude files containing specific content
showTreeViewbooleantrueWhether to display a directory tree visualization (deprecated, use treeView instead)
treeViewboolean|objecttrueTree view configuration, can be a boolean or detailed configuration object
modifiersarray[]Content modifiers to apply

Basic Usage

First you need to specify packages you want to include:

yaml
documents:  - description: Symfony Components  outputPath: docs/symfony-components.md  sources:  - type: composer  description: Symfony Components  packages:  - cycle/orm  - cycle/annotated

Additional filtering

You can also filter files by path, content, and other criteria:

yaml
documents:  - description: Filtered Composer Dependencies  outputPath: docs/filtered-deps.md  sources:  - type: composer  description: Filtered Dependencies  composerPath: .  packages:  - symfony/console  - symfony/http-foundation  filePattern: "*.php"  path: Component  notPath:  - tests  - vendor  contains: class  notContains: @deprecated  modifiers:  - php-signature

Tree View Configuration

You can customize the tree view with detailed configuration options:

yaml
documents:  - description: Filtered Composer Dependencies  outputPath: docs/filtered-deps.md  sources:  - type: composer  description: Filtered Dependencies  composerPath: .  packages:  - symfony/console  - symfony/http-foundation  treeView:  enabled: true  showSize: true  showLastModified: true  showCharCount: true  includeFiles: true  maxDepth: 3  dirContext:  "src/Controller": "Application controllers"  "src/Models": "Domain models and entities"

Tree View Options

OptionTypeDefaultDescription
enabledbooleantrueWhether to show the tree view
showSizebooleanfalseInclude file/directory sizes in the tree
showLastModifiedbooleanfalseInclude last modified dates in the tree
showCharCountbooleanfalseInclude character counts in the tree
includeFilesbooleantrueWhether to include files (true) or only show directories (false)
maxDepthinteger0Maximum depth of the tree to display (0 for unlimited)
dirContextobject{}Optional descriptions for specific directories

Example output with enhanced tree view:

Project ├── src/ [4.2 MB, 2024-03-12, 25,483 chars] │ ├── Controller/ [756 KB, 2024-03-10, 7,521 chars] # Application controllers │ │ ├── ApiController.php [328 KB, 2024-03-10, 3,845 chars] │ │ └── WebController.php [428 KB, 2024-03-05, 3,676 chars] │ ├── Models/ [1.2 MB, 2024-03-12, 12,345 chars] # Domain models and entities │ │ ├── User.php [128 KB, 2024-03-05, 1,234 chars] │ │ └── Product.php [96 KB, 2024-03-12, 987 chars]

Simple Boolean Usage

For backward compatibility, you can still use a boolean value:

yaml
documents:  - description: Filtered Composer Dependencies  outputPath: docs/filtered-deps.md  sources:  - type: composer  description: Filtered Dependencies  composerPath: .  packages:  - symfony/console  - symfony/http-foundation  treeView: false # Disable tree view