PHPackages                             tommander/phpsphinx - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tommander/phpsphinx

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tommander/phpsphinx
===================

A simple bridge between phpDocumentor and Sphinx.

v0.3.2(1y ago)036[1 issues](https://github.com/tommander/phpsphinx/issues)MITPHP

Since Jan 4Pushed 1y agoCompare

[ Source](https://github.com/tommander/phpsphinx)[ Packagist](https://packagist.org/packages/tommander/phpsphinx)[ RSS](/packages/tommander-phpsphinx/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (7)Used By (0)

PhpSphinx
=========

[](#phpsphinx)

[![PHP QA](https://github.com/tommander/phpsphinx/actions/workflows/php.yml/badge.svg)](https://github.com/tommander/phpsphinx/actions/workflows/php.yml/badge.svg)

A simple PHP script for use in command line. This script takes an XML file generated by [phpDocumentor](https://phpdoc.org/) and generates a [Sphinx](https://www.sphinx-doc.org/en/master/)-ready API documentation in the output folder.

Prerequisites
-------------

[](#prerequisites)

1. [git](https://git-scm.com/)
2. [composer 2.2+](https://getcomposer.org/)
3. [Sphinx](https://www.sphinx-doc.org/en/master/usage/installation.html)
    1. Extension `sphinx_rtd_theme`
    2. Domain `PHP`
4. [phpDocumentor](https://github.com/phpdocumentor/phpdocumentor?tab=readme-ov-file#using-the-phar)
5. [PHP 7.4+](https://php.net)

Note: if your PHP version is different from 8.2, you *might* need to run `composer update`.

Composer Installation
---------------------

[](#composer-installation)

First require the package as a dev dependency.

```
cd /path/to/your/project
composer require --dev tommander/phpsphinx

php vendor/bin/phpsphinx -i"/path/to/structure.xml" -o"/path/to/docs/api"
```

Manual Installation
-------------------

[](#manual-installation)

First clone the repo and install dependencies.

```
cd /some/path
git clone https://github.com/tommander/phpsphinx
cd phpsphinx
composer install

php bin/phpsphinx -i"/path/to/structure.xml" -o"/path/to/docs/api"
```

Use In Existing Projects
------------------------

[](#use-in-existing-projects)

First, check that you have all the prerequisites.

```
git --version
composer --version
php --version
sphinx-build --version
php phpDocumentor.phar --version
```

Then you can create a folder for the documentation. In the example, it is `docs`. Create two subfolders, `source` and `build`.

In the `docs/source` subfolder, create a folder named `api` and a file named `conf.py` e.g. with this content:

```
project = 'A Project'
copyright = '2025, Me'
author = 'Me'
release = '0.0.0'
extensions = ['sphinx_rtd_theme', 'sphinxcontrib.phpdomain']
exclude_patterns = []
primary_domain = 'php'
html_theme = 'sphinx_rtd_theme'
```

Then you can create `.rst` files and other subfolders in the `source` directory as needed. That will be the static part of your documentation. Just don't create anything in the folder `api`; it will contain the automatically generated docs.

Next, create a file named `Makefile` in the root of your project e.g. with this content:

```
SPHINXOPTS    ?=
# If your Sphinx installation is not global, prepend "sphinx-build" with the path to it.
SPHINXBUILD   ?= sphinx-build
SOURCEDIR     = docs/source
BUILDDIR      = docs/build

# Put it first so that "make" without argument is like "make help".
help:
	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
```

Now you are ready to generate the documentation.

```
# Run phpDocumentor.
php phpDocumentor.phar -d src --template="xml" -t phpdoc

# Run PhpSphinx.
php bin/phpsphinx --i"phpdoc/structure.xml" -o"docs/source/api"

# Sphinx cleanup.
make clean

# Sphinx build docs in HTML format.
make html
```

And if all went well, you should have your beautiful documentation in `docs/build`.

This flow is just an example; there is plenty of room for adjustment of this flow to your needs.

Quality Assurance
-----------------

[](#quality-assurance)

It is recommended to run QA check before pushing anything to the repo. For branches "main" and "devel", this check runs automatically on a push/PR anyway.

[PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) with coding standards `PSR-12` and `PHP-Compatibility`.

[psalm](https://psalm.dev/) for static analysis.

[phpunit](https://github.com/sebastianbergmann/phpunit) for unit testing.

```
composer validate --strict
composer qa
```

Issues
------

[](#issues)

Please track in [GitHub Issues](https://github.com/tommander/phpsphinx/issues).

Pull Requests
-------------

[](#pull-requests)

[Contributing](.github/CONTRIBUTING.md).

Documentation
-------------

[](#documentation)

All important information is in the main file [src/StructureToRst.php](src/StructureToRst.php).

Executable [bin/phpsphinx](bin/phpsphinx) is a PHP file that should be called via command-line. It just takes two options (`-i` for input XML file path and `-o` for output API docs path) and then calls the code in the main file.

Simple unit test [tests/StructureToRstTest.php](tests/StructureToRstTest.php) ensures to a certain degree that, for a given XML structure, an expected output is generated.

License
-------

[](#license)

[MIT License](LICENSE).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance41

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~92 days

Total

5

Last Release

495d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1384f21c786dd1063023cb9543c6cdc24cbc9362836ee24b00c16f693fd50f41?d=identicon)[tommander](/maintainers/tommander)

---

Top Contributors

[![tommander](https://avatars.githubusercontent.com/u/8601794?v=4)](https://github.com/tommander "tommander (30 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tommander-phpsphinx/health.svg)

```
[![Health](https://phpackages.com/badges/tommander-phpsphinx/health.svg)](https://phpackages.com/packages/tommander-phpsphinx)
```

###  Alternatives

[ocramius/proxy-manager

A library providing utilities to generate, instantiate and generally operate with Object Proxies

5.0k82.4M230](/packages/ocramius-proxy-manager)[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[ocramius/package-versions

Provides efficient querying for installed package versions (no runtime IO)

3.2k74.3M117](/packages/ocramius-package-versions)[jean85/pretty-package-versions

A library to get pretty versions strings of installed dependencies

1.3k289.5M63](/packages/jean85-pretty-package-versions)[icanhazstring/composer-unused

Show unused packages by scanning your code

1.7k7.0M188](/packages/icanhazstring-composer-unused)[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k74.6k86](/packages/pocketmine-pocketmine-mp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
