Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add phpDocumentor instructions to Makefile #1385

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ tests/TraceContext/W3CTestService/trace-context

# deptrac cache
/.deptrac.cache

# output from phpdoc
docs/build

# cache from phpdoc
.phpdoc
18 changes: 18 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,21 @@ make phpmetrics

This will generate a HTML PhpMetrics report in the `var/metrics` directory. Make sure to run `make test` before to
create the test log-file, used by the metrics report.

## API Documentation

We use [phpDocumentor](https://phpdoc.org/) to automatically generate API documentation from DocBlocks in the code.

To generate a recent version of the API documentation, you can run:

```bash
make phpdoc
```

To preview the documentation and changes you might expect, you can run:

```bash
make phpdoc-preview
```

This will start a HTTP server running at <http://localhost:8080> serving the updated documentation files.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ psalm: ## Run psalm
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor-bin/psalm/vendor/bin/psalm --threads=1 --no-cache
psalm-info: ## Run psalm and show info
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor-bin/psalm/vendor/bin/psalm --show-info=true --threads=1
phpdoc: ## Run phpdoc
$(DOCKER_COMPOSE) -f docker-compose.phpDocumentor.yaml run --rm phpdoc
phpdoc-preview:
$(DOCKER_COMPOSE) -f docker-compose.phpDocumentor.yaml run --service-ports --rm preview
phpstan: ## Run phpstan
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpstan analyse --memory-limit=256M
infection: ## Run infection (mutation testing)
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.phpDocumentor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
phpdoc:
image: phpdoc/phpdoc:3
volumes:
- ./:/data
preview:
image: nginx:alpine
ports:
- 8080:80
volumes:
- ./docs/build:/usr/share/nginx/html
11 changes: 11 additions & 0 deletions phpdoc.dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdocumentor
configVersion="3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://www.phpdoc.org"
>
<title>OpenTelemetry PHP</title>
<paths>
<output>docs/build</output>
</paths>
</phpdocumentor>
Loading