phpzlc/document-bundle

Dotenv

DOC_HOST=http://dome-api.com

.gitignore

public/apidoc/

Generated files

Document/Config.php

<?php

namespace App\Document;

class Config
{
    /**
     * 标题
     *
     * @return string
     */
    public static function getTitle()
    {
        return '演示';
    }

    /**
     * 出版商
     *
     * @return string
     */
    public static function getPublishing()
    {
        return '';
    }

    /**
     * 说明
     *
     * @return string
     */
    public static function getExplain()
    {
        return '';
    }

    /**
     * 注意
     *
     * @return string
     */
    public static function getNote()
    {
        return '';
    }

    /**
     * 附录
     *
     * @return string
     */
    public static function getAppendix()
    {
        return '';
    }

    /**
     * 主机
     *
     * @return mixed
     */
    public static function getHost()
    {
        return $_ENV['DOC_HOST'];
    }
}

Document/DemoDocument.php

<?php

namespace App\Document;

use PHPZlc\Document\Document;

class DemoDocument extends Document
{
    public function demoAction()
    {
        $this->add()
            ->setTitle('演示接口')
            ->setUrl('/demo')
            ->setReturnType('html')
            ->setReturn('演示接口')
            ->generate();
    }
}