PHPackages                             vuryss/dokky - 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. [API Development](/categories/api)
4. /
5. vuryss/dokky

ActiveLibrary[API Development](/categories/api)

vuryss/dokky
============

OpenAPI 3.1 documentation generator for PHP

v4.0.0(2mo ago)04.2k↓32.1%[1 issues](https://github.com/vuryss/dokky/issues)[4 PRs](https://github.com/vuryss/dokky/pulls)MITPHPPHP ^8.5CI passing

Since Mar 20Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/vuryss/dokky)[ Packagist](https://packagist.org/packages/vuryss/dokky)[ RSS](/packages/vuryss-dokky/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (28)Versions (30)Used By (0)

DOKKY
=====

[](#dokky)

*Empower APIs with Seamless Documentation Precision*

[![codecov](https://camo.githubusercontent.com/85180a600d1cc67555292a46815df65d85c5e6e68a35358d8a54616000145dc8/68747470733a2f2f636f6465636f762e696f2f6769746875622f7675727973732f646f6b6b792f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d58586a32506573573067)](https://codecov.io/github/vuryss/dokky)[![CodeRabbit Pull Request Reviews](https://camo.githubusercontent.com/213832ce41d61a375440110627c9a093a23ffe6242057298406c606b643ae06c/68747470733a2f2f696d672e736869656c64732e696f2f636f64657261626269742f7072732f6769746875622f7675727973732f646f6b6b793f75746d5f736f757263653d6f73732675746d5f6d656469756d3d6769746875622675746d5f63616d706169676e3d767572797373253246646f6b6b79266c6162656c436f6c6f723d31373137313726636f6c6f723d464635373041266c696e6b3d6874747073253341253246253246636f64657261626269742e6169266c6162656c3d436f64655261626269742b52657669657773)](https://camo.githubusercontent.com/213832ce41d61a375440110627c9a093a23ffe6242057298406c606b643ae06c/68747470733a2f2f696d672e736869656c64732e696f2f636f64657261626269742f7072732f6769746875622f7675727973732f646f6b6b793f75746d5f736f757263653d6f73732675746d5f6d656469756d3d6769746875622675746d5f63616d706169676e3d767572797373253246646f6b6b79266c6162656c436f6c6f723d31373137313726636f6c6f723d464635373041266c696e6b3d6874747073253341253246253246636f64657261626269742e6169266c6162656c3d436f64655261626269742b52657669657773)

Overview
--------

[](#overview)

Dokky is a powerful developer tool designed to streamline the process of generating OpenAPI 3.1 documentation for PHP projects.

It lets you parse PHP classes and their properties, automatically generating the necessary OpenAPI schema definitions.

Purpose
-------

[](#purpose)

To be used inside frameworks for automatic generation of API Documentation (similar to API Platform).

Features
--------

[](#features)

- Provides OpenAPI class abstractions for easy manipulation of OpenAPI structures via PHP objects.
- Provides attributes for decorating classes and properties indicating how they should be represented in OpenAPI.
- Supports Symfony serializer and validator attributes for seamless integration.
- Generates OpenAPI Schemas based on PHP Classes and their properties. Correctly parses PHP Types and type annotations.

Symfony Compatibility
---------------------

[](#symfony-compatibility)

Dokky supports Symfony 7.4 LTS and Symfony 8.x.

For local validation inside the project container:

```
docker compose exec -T dokky composer deps:highest
docker compose exec -T dokky composer qa
docker compose exec -T dokky composer deps:lowest
docker compose exec -T dokky composer qa
```

The default local development flow should use `composer deps:highest`, while CI runs both the lowest and highest supported dependency sets to verify the compatibility matrix.

`composer deps:lowest` only moves the Symfony dependency family to its lowest supported versions, while `composer deps:highest` refreshes the full dependency graph to the newest allowed versions.

Example usage:
--------------

[](#example-usage)

### Overwriting single property's schema

[](#overwriting-single-propertys-schema)

```
class DataWithSchemaOverwrite
{
    #[Property(
        schema: new Schema(
            description: 'Some description',
            examples: ['test1', 'test2'],
            enum: ['test1', 'test2', 'test3']
        )
    )]
    public string $property;
}
```

### Array schema handling

[](#array-schema-handling)

Array type can usually be declared in several ways, here are the two supported cases:

1. List of elements of given type. Represented as JSON array type. Must be sequentially indexed array.

- `array`
- `array`
- `Type[]`
- `list`
- `iterable`

Example JSON structure:

```
[
    {/*Type object*/},
    {/*Type object*/}
]
```

2. Associative array of given type. Represented as JSON object type. JSON objects always have string keys, even if they are integers in PHP.

- `array`

Example JSON structure:

```
{
    "key1": {/*Type object*/},
    "key2": {/*Type object*/}
}
```

Even with non-sequential integer keys, still JSON object:

```
{
    "100": {/*Type object*/},
    "200": {/*Type object*/}
}
```

### Considering nullable properties as not-required

[](#considering-nullable-properties-as-not-required)

Sometimes, to be consistent with serializers, which can skip null values, you might want to consider nullable properties as not-required. In this case, you can use a configuration option to switch the required property behavior.

This can be done by passing a configuration object to the class schema generator like this:

```
$configuration = new \Dokky\Configuration(
    considerNullablePropertiesAsNotRequired: true,
);
new Dokky\ClassSchemaGenerator\ClassSchemaGenerator(configuration: $configuration)
```

### Full documentation example

[](#full-documentation-example)

```
$componentsRegistry = new Dokky\ComponentsRegistry();
$componentsGenerator = new Dokky\ComponentsGenerator(
    componentsRegistry: $componentsRegistry,
    classSchemaGenerator: new Dokky\ClassSchemaGenerator\ClassSchemaGenerator(
        componentsRegistry: $componentsRegistry,
    ),
);

$openApi = new Dokky\OpenApi\OpenApi(
    openapi: '3.1.0',
    info: new Dokky\OpenApi\Info(
        title: 'Test API',
        version: '1.0.0',
        description: 'Auto generated documentation for Test API',
    ),
    paths: [
        '/user/{id}' => new Dokky\OpenApi\PathItem(
            get: new Dokky\OpenApi\Operation(
                operationId: 'get_user',
                responses: [
                    '200' => new Dokky\OpenApi\Response(
                        description: 'User data',
                        content: [
                            'application/json' => new Dokky\OpenApi\MediaType(
                                schema: new Dokky\OpenApi\Schema(
                                    ref: $componentsRegistry->getSchemaReference(User::class),
                                ),
                            ),
                        ],
                    ),
                ],
            ),
        ),
    ],
    components: $componentsGenerator->generateComponents(),
);
```

### Using Named Schemas

[](#using-named-schemas)

In some cases, you might want to define a specific name for a schema in the components section, rather than relying on the auto-generated name based on the class. You can achieve this using the `getNamedSchemaReference` method:

```
$componentsRegistry = new Dokky\ComponentsRegistry();

// Register a class with a specific schema name
$userSchemaRef = $componentsRegistry->getNamedSchemaReference(
    className: User::class,
    schemaName: 'DetailedUserOutput'
); // Returns '#/components/schemas/DetailedUserOutput'

// You can still use the auto-generated name if needed elsewhere
$basicUserRef = $componentsRegistry->getSchemaReference(User::class); // Returns '#/components/schemas/User' (or similar if name conflicts)

// Use the named reference in your OpenAPI definition
$openApi = new Dokky\OpenApi\OpenApi(
    // ... other properties
    paths: [
        '/user/{id}' => new Dokky\OpenApi\PathItem(
            get: new Dokky\OpenApi\Operation(
                responses: [
                    '200' => new Dokky\OpenApi\Response(
                        description: 'Detailed user data',
                        content: [
                            'application/json' => new Dokky\OpenApi\MediaType(
                                schema: new Dokky\OpenApi\Schema(ref: $userSchemaRef), // Use the named reference
                            ),
                        ],
                    ),
                ],
            ),
        ),
    ],
    // ... components generation will include both 'DetailedUserOutput' and 'User' schemas
);
```

### Retrieving full list of used classes

[](#retrieving-full-list-of-used-classes)

For debugging purposes, you might need the full list of classes used in the OpenAPI schema. Also, if you like to apply some caching based on whether any of the classes changed, you can use this method to get the list of classes used in the OpenAPI schema.

```
$componentsRegistry = new Dokky\ComponentsRegistry();
$componentsGenerator = new Dokky\ComponentsGenerator(
    componentsRegistry: $componentsRegistry,
    classSchemaGenerator: new Dokky\ClassSchemaGenerator\ClassSchemaGenerator(
        componentsRegistry: $componentsRegistry,
    ),
);

$openApi = new Dokky\OpenApi\OpenApi(
    // ... other properties
    components: $componentsGenerator->generateComponents(),
);

$usedClasses = $componentsRegistry->getUniqueClassNames();
```

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance89

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 85.1% 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 ~25 days

Recently: every ~76 days

Total

15

Last Release

68d ago

Major Versions

v1.6.0 → v2.0.02025-09-19

v2.1.0 → v3.0.02025-12-15

v3.0.0 → v4.0.02026-03-12

PHP version history (2 changes)v1.5.0PHP ^8.4

v4.0.0PHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/70759f4deef30c94bac54f3c2243202d62595f3b55c9a4f88b19f32c1bcfad0f?d=identicon)[vuryss](/maintainers/vuryss)

---

Top Contributors

[![vuryss](https://avatars.githubusercontent.com/u/7021705?v=4)](https://github.com/vuryss "vuryss (63 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vuryss-dokky/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[symfony/serializer-pack

A pack for the Symfony serializer

1.1k28.2M221](/packages/symfony-serializer-pack)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k7.8M57](/packages/dedoc-scramble)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5723.1M30](/packages/thecodingmachine-graphqlite)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)

PHPackages © 2026

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