PHPackages                             docsdog/docsdog-php - 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. docsdog/docsdog-php

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

docsdog/docsdog-php
===================

Documentation's best friend.

v0.1.2(1mo ago)02AGPL-3.0-only

Since Jun 21Compare

[ Source](https://github.com/Hugo0Vaz/docsdog-php)[ Packagist](https://packagist.org/packages/docsdog/docsdog-php)[ RSS](/packages/docsdog-docsdog-php/feed)WikiDiscussions Synced 2w ago

READMEChangelog (1)DependenciesVersions (4)Used By (0)

DocsDog PHP
===========

[](#docsdog-php)

PHP implementation of the [DocsDog specification](https://github.com/Hugo0Vaz/docsdog).

Installation
------------

[](#installation)

```
composer require docsdog/docsdog-php
```

Annotation Format
-----------------

[](#annotation-format)

Relationships are declared inside PHP docblocks using the `@docsdog` annotation:

```
@docsdog  ::

```

Example:

```
/**
 * Handles creation of invoices from purchase orders.
 *
 * @docsdog implements docsdog:usecase:UC-001
 * @docsdog decision docsdog:adr:ADR-004
 */
final class CreateInvoiceService
{
    /**
     * @docsdog requires docsdog:requirement:REQ-014
     */
    public function __construct(
        private readonly InvoiceRepository $repository,
        private readonly EventBus $eventBus,
    ) {}

    /**
     * @docsdog validates docsdog:rule:BR-008
     */
    public function execute(CreateInvoiceCommand $command): Invoice
    {
        $invoice = Invoice::create($command);
        $this->repository->save($invoice);
        return $invoice;
    }

    /**
     * @docsdog emits docsdog:event:InvoiceCreated
     */
    private function dispatchEvents(Invoice $invoice): void
    {
        foreach ($invoice->releaseEvents() as $event) {
            $this->eventBus->publish($event);
        }
    }
}
```

Annotations are associated with the next code element (class, method, function, interface, trait, or enum) following the docblock. Multiple annotations per docblock are supported.

CLI
---

[](#cli)

```
php vendor/bin/docsdog scan [options]
```

### Options

[](#options)

OptionDefaultDescription`--src=``src`Source directory to scan`--output=`stdoutOutput file path`--version=``1.0`Scan version tag`--pretty`offPretty-print JSON output`--help`, `-h`—Show help message### Examples

[](#examples)

```
# Scan src/ directory, write to file with pretty output
php vendor/bin/docsdog scan --src=src --output=docsdog-scan.json --pretty

# Scan app/ directory, print to stdout
php vendor/bin/docsdog scan --src=app

# Pipe into another tool
php vendor/bin/docsdog scan --src=src | your-tool
```

Output Format
-------------

[](#output-format)

The scanner produces a JSON document conforming to the [scan schema](https://github.com/Hugo0Vaz/docsdog/blob/main/scan.schema.json):

```
{
  "version": "1.0",
  "relationships": [
    {
      "source": "php://src/Application/CreateInvoiceService.php#L13",
      "predicate": "implements",
      "target": "docsdog:usecase:UC-001"
    },
    {
      "source": "php://src/Application/CreateInvoiceService.php#L13",
      "predicate": "decision",
      "target": "docsdog:adr:ADR-004"
    }
  ]
}
```

Programmatic API
----------------

[](#programmatic-api)

### Scanning files

[](#scanning-files)

```
use Docsdog\DocsdogPhp\Scanner\PhpFileScanner;

$scanner = new PhpFileScanner();
$relationships = $scanner->scan('src/Application/CreateInvoiceService.php');

foreach ($relationships as $rel) {
    echo $rel->source()->toString();   // php://src/...php#L13
    echo $rel->predicate()->value;     // implements
    echo $rel->target()->toString();   // docsdog:usecase:UC-001
}
```

### Building relationships manually

[](#building-relationships-manually)

```
use Docsdog\DocsdogPhp\Identifier\DocsDogNamespace;
use Docsdog\DocsdogPhp\Identifier\SourceIdentifier;
use Docsdog\DocsdogPhp\Identifier\TargetIdentifier;
use Docsdog\DocsdogPhp\Model\Relationship;
use Docsdog\DocsdogPhp\Model\Scan;
use Docsdog\DocsdogPhp\Predicate;

$rel = Relationship::create(
    SourceIdentifier::parse('php://src/Service.php#L42'),
    Predicate::implements(),
    DocsDogNamespace::usecase('UC-001'),
    ['since' => '2.1'], // optional metadata
);

$scan = Scan::of('1.0', [$rel]);
echo $scan->toJson(JSON_PRETTY_PRINT);
```

### Working with identifiers

[](#working-with-identifiers)

```
use Docsdog\DocsdogPhp\Identifier\DocsDogNamespace;
use Docsdog\DocsdogPhp\Identifier\TargetIdentifier;

// Built-in docsdog namespace (typed helpers)
$t1 = DocsDogNamespace::requirement('REQ-014');    // docsdog:requirement:REQ-014
$t2 = DocsDogNamespace::api('post', '/invoices');   // docsdog:api:POST:/invoices
$t3 = DocsDogNamespace::table('invoices');          // docsdog:table:invoices

// External namespaces (generic parser)
$t4 = TargetIdentifier::parse('jira:issue:ERP-123');
$t5 = TargetIdentifier::parse('github:repo:company/project#15');
```

Running Tests
-------------

[](#running-tests)

```
php test-suite.php
```

###  Health Score

31

—

LowBetter than 65% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

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 ~0 days

Total

3

Last Release

45d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d439744c516fad8da2fca4ba14889b2bf44be4d1f05a3c4e89877a448a0a534?d=identicon)[Hugo0Vaz](/maintainers/Hugo0Vaz)

### Embed Badge

![Health badge](/badges/docsdog-docsdog-php/health.svg)

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

###  Alternatives

[cayetanosoriano/hashids-bundle

Bundle for integration of hashids lib to the container

22168.4k](/packages/cayetanosoriano-hashids-bundle)

PHPackages © 2026

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