PHPackages                             thiagoarioli/yii2-rest-doc-slade-version - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. thiagoarioli/yii2-rest-doc-slade-version

ActiveYii2-extension[HTTP &amp; Networking](/categories/http)

thiagoarioli/yii2-rest-doc-slade-version
========================================

A Yii2 tool to create slate index.md for you REST controllers.

1.1(9y ago)086[1 issues](https://github.com/thiagoarioli/yii2-rest-doc-slade-version/issues)BSD-3-ClausePHPPHP &gt;=5.4.0

Since Jul 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/thiagoarioli/yii2-rest-doc-slade-version)[ Packagist](https://packagist.org/packages/thiagoarioli/yii2-rest-doc-slade-version)[ Docs](https://github.com/thiagoarioli/yii2-rest-doc-slade-version)[ RSS](/packages/thiagoarioli-yii2-rest-doc-slade-version/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

yii2-rest-doc-slade-version
===========================

[](#yii2-rest-doc-slade-version)

This is a version off yii2-rest-doc created by @pahanini

\#Yii2 Rest Controller Documentator

[![Build Status](https://camo.githubusercontent.com/70fed7d228854381c6e8398028584f9b43c80b33d72c705db1b7e11ae034fa67/68747470733a2f2f7472617669732d63692e6f72672f706168616e696e692f796969322d726573742d646f632e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pahanini/yii2-rest-doc)[![Latest Stable Version](https://camo.githubusercontent.com/e8f9e6760df9edcfee1e9c7fdf6848f4ff8220d6e5ea7299a75ad0bd2238d845/68747470733a2f2f706f7365722e707567782e6f72672f706168616e696e692f796969322d726573742d646f632f762f737461626c65)](https://packagist.org/packages/pahanini/yii2-rest-doc)[![Total Downloads](https://camo.githubusercontent.com/22a6e1ecda2972f4c71b2c3e07a500d05dbbfb3fb00c3681514057f39debeadb/68747470733a2f2f706f7365722e707567782e6f72672f706168616e696e692f796969322d726573742d646f632f646f776e6c6f616473)](https://packagist.org/packages/pahanini/yii2-rest-doc)[![Latest Unstable Version](https://camo.githubusercontent.com/0d7c68943d9714959069c3aed27b750655f159eed1ab7c39c64f3bc6aacb01a1/68747470733a2f2f706f7365722e707567782e6f72672f706168616e696e692f796969322d726573742d646f632f762f756e737461626c65)](https://packagist.org/packages/pahanini/yii2-rest-doc)[![License](https://camo.githubusercontent.com/7ad7cf6ce1cbb783c337133e9458d4feabc14fd54277d4c93ff69bf41b64ca3d/68747470733a2f2f706f7365722e707567782e6f72672f706168616e696e692f796969322d726573742d646f632f6c6963656e7365)](https://packagist.org/packages/pahanini/yii2-rest-doc)

About
-----

[](#about)

Create precise documentation to your Yii2 API [REST](http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html)controllers. Library parses your code and generates objects with meta data that could be used with any template engine to generate great API docs.

You do not need to edit documentation when you change you code. Just rebuild you docs with this tool.

Install
-------

[](#install)

- Add `"pahanini/yii2-rest-doc": "*"` to required section of your composer.json
- Add to your console application config

```
'controllerMap' => [
	'build-rest-doc' => [
		'sourceDirs' => [
			'@frontend\controllers\rest',   //  '//restdoc/restdoc.twig',
		'class' => '\pahanini\restdoc\controllers\BuildController',
		'sortProperty' => 'shortDescription', //  'path/to/nice-documentation.html'
	],
]
```

Data available in template
--------------------------

[](#data-available-in-template)

List of data automatically extracted from code:

- controller name
- action's of each controller
- model fields
- extra fields
- model rules (TBD)

List of special tags:

- short and long description of controller
- query tags

Inheritance is also supported. Use `@inherited` or `@inheritdoc` tags.

### Controller

[](#controller)

- `@restdoc-ignore` - skip controller.
- `@restdoc-label name` - mark controller with label. Label name available via `controller.hasLabel('labelName')` in template
- `@restdoc-query name=false Name of part of name to find users` - query params with description.

### Model

[](#model)

To describe model's fields you can use two approaches.

#### Link to property tag.

[](#link-to-property-tag)

If you already have phpDocumentator `@property` tag you can use it to describe API field. Model's doc block example:

```
/**
 * My model.
 *
 * @property string $title Model's title
 */
```

- `@restdoc-link $title` - use `$title` property to describe `$title` api field
- `@restdoc-link title $model_title` - use `$title` property to describe `$model_title` api field

### Separate field description

[](#separate-field-description)

If you do not have `@property` tag or API field is not directly connected with property use `@restdoc-field` tag.

Example:

```
/**
 * @restdoc-field int $id ID
 * @restdoc-field string $title Model's title
 */
```

### Extra fields

[](#extra-fields)

Use @restdoc-extraField and @restdoc-extraLink for extra fields.

### Sort fields

[](#sort-fields)

Use @restdoc-sortField to sort field according to your code.

Integrate With Slate
--------------------

[](#integrate-with-slate)

[Slate](https://github.com/tripit/slate) is probably one of the best tools to generate nice API. So you can use this tool to create index.md file for slate. You can use on afterAction event to automatically start slate.

Example:

```
'controllerMap' => [
    'build-rest-doc' => [
        'sourceDirs' => [
            '@api/modules/v1/controllers',   //  '//restdoc/slate.php',
        'class' => '\thiagoarioli\restdoc\controllers\BuildController',
        'targetFile' => '@console/slate/source/index.html.md',
        'on afterAction' => function() {
            exec("bundle exec middleman build");
        }
    ],
]
```

Rationale
---------

[](#rationale)

Creating of Yii2 controllers is an easy task, but supporting of documentation in actual state is often boring and tough challenge. Using automatic tool like [phpDocumentator](https://github.com/phpDocumentor/phpDocumentor2)or [swagger](http://swagger.io/) makes life easier but its still require to describe all models fields and rules using tags or comments.

In other hand Yii2 controllers and models keep a lot of information about internal structure like actions,
field names, scenarios for update and insert operations. This package extracts such an information from REST controllers and models and using this data along with phpdocumentator tags automatically generates index.md for [slate](https://github.com/tripit/slate) or any other documentation file.

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

2

Last Release

3540d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/da5f5d6f002b82974f24750025ad9d02f9ee8ecea2c1a54bc21d72b5ba553c4e?d=identicon)[thiagoarioli](/maintainers/thiagoarioli)

---

Top Contributors

[![thiagoarioli](https://avatars.githubusercontent.com/u/3638321?v=4)](https://github.com/thiagoarioli "thiagoarioli (9 commits)")

---

Tags

apirestdocyii2slate

### Embed Badge

![Health badge](/badges/thiagoarioli-yii2-rest-doc-slade-version/health.svg)

```
[![Health](https://phpackages.com/badges/thiagoarioli-yii2-rest-doc-slade-version/health.svg)](https://phpackages.com/packages/thiagoarioli-yii2-rest-doc-slade-version)
```

###  Alternatives

[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k62.5M217](/packages/nelmio-api-doc-bundle)[pahanini/yii2-rest-doc

A Yii2 tool to create slate index.md for you REST controllers.

3627.9k](/packages/pahanini-yii2-rest-doc)[hiqdev/yii2-hiart

ActiveRecord for API

5951.5k3](/packages/hiqdev-yii2-hiart)

PHPackages © 2026

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