Skip to content

Commit aa24249

Browse files
committed
Add rendered documentation for website
1 parent ab969af commit aa24249

16 files changed

+255
-24
lines changed

.github/workflows/documentation.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Documentation"
2+
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
branches:
6+
- "6.x"
7+
pull_request: null
8+
9+
jobs:
10+
documentation:
11+
name: "Documentation"
12+
runs-on: "ubuntu-latest"
13+
steps:
14+
- name: "Checkout"
15+
uses: "actions/checkout@v4"
16+
17+
- name: "Build"
18+
uses: "phpDocumentor/phpDocumentor@master"
19+
20+
- name: "Deploy"
21+
if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/6.x' }}"
22+
uses: "actions/upload-artifact@v4"
23+
with:
24+
name: "documentation"
25+
path: "build/docs"
26+
retention-days: 1
27+
28+
deploy:
29+
name: "Deploy"
30+
if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/6.x' }}"
31+
runs-on: "ubuntu-latest"
32+
needs: "documentation"
33+
steps:
34+
- name: "Checkout"
35+
uses: "actions/checkout@v4"
36+
with:
37+
repository: "phpDocumentor/docs"
38+
token: "${{ secrets.BOT_TOKEN }}"
39+
path: "docs"
40+
41+
- name: "Download"
42+
uses: "actions/download-artifact@v4"
43+
with:
44+
name: "documentation"
45+
path: "build/docs"
46+
47+
- name: "Copy files"
48+
run: "rsync -r --delete build/docs/* docs/docs/components/reflection"
49+
50+
- name: "Commit"
51+
uses: "stefanzweifel/git-auto-commit-action@v5"
52+
with:
53+
repository: "docs"
54+
commit_message: "Update reflection documentation"
55+
56+
- name: "Push"
57+
uses: "ad-m/github-push-action@master"
58+
with:
59+
directory: "docs"
60+
github_token: "${{ secrets.BOT_TOKEN }}"
61+
repository: "phpDocumentor/docs"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ vendor/
1717
phpunit.xml
1818
.phpunit.result.cache
1919
.phpunit.cache
20+
21+
.phpdoc/cache

.phpdoc/template/base.html.twig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% extends 'layout.html.twig' %}
2+
3+
{% set topMenu = {
4+
"menu": [
5+
{ "name": "About", "url": "https://phpdoc.org/"},
6+
{ "name": "Components", "url": "https://phpdoc.org/components.html"},
7+
{ "name": "Documentation", "url": "https://docs.phpdoc.org/"},
8+
],
9+
"social": [
10+
{ "iconClass": "fab fa-mastodon", "url": "https://phpc.social/@phpdoc"},
11+
{ "iconClass": "fab fa-github", "url": "https://github.com/phpdocumentor/typeresolver"},
12+
{ "iconClass": "fas fa-envelope-open-text", "url": "https://github.com/orgs/phpDocumentor/discussions"}
13+
]
14+
}
15+
%}

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ fix-code-style:
1111
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpcbf
1212

1313
.PHONY: static-code-analysis
14-
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm
14+
static-code-analysis: #vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm
1515
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.2-cli vendor/bin/phpstan --configuration=phpstan.neon
16-
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.2-cli vendor/bin/psalm.phar
16+
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.2-cli vendor/bin/psalm.phar --show-info=true --threads=4
1717

1818
.PHONY: test
1919
test: test-unit test-functional ## Runs all test suites with phpunit/phpunit
@@ -45,3 +45,7 @@ rector: ## Refactor code using rector
4545

4646
.PHONY: pre-commit-test
4747
pre-commit-test: fix-code-style test code-style static-code-analysis
48+
49+
.PHONY: docs
50+
docs: ## Generate documentation
51+
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpdoc:3-unstable

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ are however several advantages to using this library:
3737
In order to inspect a codebase you need to tell composer to include the `phpdocumentor/reflection` package. This
3838
can easily be done using the following command in your command line terminal:
3939

40-
composer require phpdocumentor/reflection:~5.0
40+
composer require phpdocumentor/reflection:~6.0
4141

4242
After the installation is complete no further configuration is necessary and you can immediately start using it.
4343

docs/extending/index.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _extending:
2+
3+
Extend the library
4+
==================
5+
6+
The model exposed by this library is closed for inheritance. We did this to ensure the model is stable and does not
7+
change via external factors. The complexity of this project makes it hard to keep all the internal classes stable.
8+
The model is designed to be cached and constructed very carefully to ensure performance and memory usage are optimal.
9+
10+
Metadata
11+
--------
12+
13+
Metadata is a way to extend the model with additional information. We call this metadata, as all first class
14+
elements in the reflected codebase are part of the model. Extra data can be added to these elements using metadata.
15+
16+
Elements supporting metadata are:
17+
18+
.. phpdoc:class-list:: [?(@.interfaces contains "\phpDocumentor\Reflection\Metadata\MetaDataContainer")]
19+
20+
.. phpdoc:name::
21+
22+
.. warning::
23+
24+
Adding metadata might break the posibilty to cache the model. Be carefull with circular references and large
25+
objects. We do recommend to keep the metadata small and simple.
26+
27+
Continue reading :doc:`Creating your first metadata <meta-data>`_ to learn how to create your own metadata.
28+
29+
.. toctree::
30+
:maxdepth: 1
31+
:titlesonly:
32+
:hidden:
33+
34+
meta-data
File renamed without changes.

docs/filtering.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/getting-started.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Getting started
2+
===============
3+
4+
This page will give you a quick introduction to the `phpdocumentor/reflection` package and how to get started with it.
5+
6+
Installation
7+
------------
8+
9+
In order to inspect a codebase you need to tell composer to include the `phpdocumentor/reflection` package. This
10+
can easily be done using the following command in your command line terminal:
11+
12+
.. code-block:: bash
13+
14+
composer require phpdocumentor/reflection:~6.0
15+
16+
In order to use the library you need to include the autoloader of composer in your code.
17+
This can be done by adding the following line to your code:
18+
19+
.. code-block:: php
20+
21+
<?php
22+
require_once 'vendor/autoload.php';
23+
24+
After the installation is complete no further configuration is necessary and you can immediately start using it.
25+
26+
Basic usage
27+
------------
28+
29+
The :php:class:`\phpDocumentor\Reflection\Php\ProjectFactory` class is the entry point to the library and is used to create a new
30+
project object that contains all the information about your codebase. It is configured with sensible defaults. And for most
31+
usecases you can just use it as is.
32+
33+
.. code-block:: php
34+
35+
$projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance();
36+
37+
At this point we are ready to analyze your complete project or just one file at the time. Just pass an array of file paths to the `create` method of the project factory.
38+
39+
.. code-block:: php
40+
41+
$projectFiles = [new \phpDocumentor\Reflection\File\LocalFile('tests/example.file.php')];
42+
$project = $projectFactory->create('My Project', $projectFiles);
43+
44+
When the process is ready a new object of type :php:class:`phpDocumentor\Reflection\Php\Project` will be returned that
45+
contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also
46+
all namespaces and packages as a hierarchical tree.
47+
This library does not provide a way to access the structure of the codebase in a searchable way.
48+
This is up to the consumer of the library to implement.
49+

docs/incremental-updates.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)