Skip to content

Commit 4b94be4

Browse files
authored
docs: Add Claude AI guidance and PHP requirement (#24)
- Introduce CLAUDE.md to provide project context and development instructions for AI assistants. - Update README.md to explicitly state the PHP 8.2+ requirement. - Add .claude to .gitignore to prevent committing AI-generated files.
1 parent 0e6690a commit 4b94be4

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ vendor
1717
phpunit.xml
1818
*.cache
1919
tests/fixtures/lib-*
20+
.claude

CLAUDE.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is **jbzoo/composer-graph**, a PHP CLI tool that renders dependency graphs from composer.json and composer.lock files. It generates HTML visualizations using Mermaid.js to display package dependencies, PHP extensions, dev dependencies, and suggested packages.
8+
9+
## Development Commands
10+
11+
### Primary Commands
12+
- `make update` - Install/update all dependencies using Composer
13+
- `make build` - Install dependencies and build PHAR file
14+
- `make test-all` - Run full test suite and code style checks
15+
- `make test` - Run PHPUnit tests only
16+
- `make codestyle` - Run code style checks and fixes
17+
18+
### Testing
19+
- `vendor/bin/phpunit` - Run PHPUnit tests directly
20+
- Tests are in `tests/` directory with fixtures in `tests/fixtures/`
21+
- PHPUnit configuration in `phpunit.xml.dist`
22+
23+
### Code Quality Tools
24+
The project uses `jbzoo/toolbox-dev` which provides various code quality tools:
25+
- `vendor/bin/php-cs-fixer` - PHP CS Fixer for code formatting
26+
- `vendor/bin/phan` - Static analysis
27+
- Various other tools available in `vendor/bin/`
28+
29+
## Architecture
30+
31+
### Core Classes
32+
- **`ComposerGraph`** (`src/ComposerGraph.php`) - Main class that builds dependency graphs using Mermaid.js
33+
- **`Collection`** (`src/Collection.php`) - Manages packages and their relationships
34+
- **`Package`** (`src/Package.php`) - Represents individual packages with dependencies
35+
- **`Helper`** (`src/Helper.php`) - Utility functions for package processing
36+
- **`Commands/Build`** (`src/Commands/Build.php`) - CLI command implementation using JBZoo CLI framework
37+
38+
### Key Dependencies
39+
- **JBZoo Libraries**: Uses `jbzoo/cli`, `jbzoo/mermaid-php`, `jbzoo/data`, `jbzoo/utils`
40+
- **Symfony Console**: For CLI interface (`symfony/console`)
41+
- **Mermaid.js**: Graph visualization via `jbzoo/mermaid-php` wrapper
42+
43+
### Main Flow
44+
1. Parse `composer.json` and `composer.lock` files from specified root directory
45+
2. Build package collection with dependencies, dev dependencies, extensions
46+
3. Generate Mermaid.js graph syntax with nodes and links
47+
4. Output as HTML file with embedded Mermaid visualization or raw Mermaid format
48+
49+
### Binary Entry Points
50+
- `composer-graph` - Shell script wrapper
51+
- `composer-graph.php` - Main PHP entry point
52+
- PHAR file is built for distribution
53+
54+
## File Structure
55+
- `src/` - Main source code (PSR-4: JBZoo\ComposerGraph namespace)
56+
- `tests/` - PHPUnit tests with fixture projects
57+
- `resources/` - Example images and assets
58+
- `build/` - Build artifacts and reports
59+
- `Makefile` - Development commands (includes jbzoo/codestyle tasks)

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# @see https://github.com/JBZoo/Composer-Graph
1111
#
1212

13-
FROM php:8.1-cli-alpine
13+
FROM php:8.4-cli-alpine
1414
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
1515

1616
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
## Installation
3131

32+
**Requirements:** PHP 8.2+
33+
3234
```shell
3335
composer require jbzoo/composer-graph # For a specific project
3436
composer global require jbzoo/composer-graph # As global tool

0 commit comments

Comments
 (0)