PHPackages                             monkeycraps/blueprint - 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. monkeycraps/blueprint

ActiveLibrary[API Development](/categories/api)

monkeycraps/blueprint
=====================

API Blueprint documentation generator.

1.0(8y ago)692BSD-3-ClausePHPPHP &gt;=5.5.9

Since Jul 20Pushed 8y agoCompare

[ Source](https://github.com/monkeycraps/blueprint)[ Packagist](https://packagist.org/packages/monkeycraps/blueprint)[ RSS](/packages/monkeycraps-blueprint/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

接口文档，生成测试工具，标准 blueprint
========================

[](#接口文档生成测试工具标准-blueprint)

1. blueprint 是一个接口文档规范，特别适合做 restful 的接口描述
2. 针对 laravel 做了一套工具，用于持续产出文档，并提供前后端调试

特性
--

[](#特性)

1. 支持 restful 请求
2. 依赖 larvel 的命令行
3. 修改了 dingo 的 blueprint 自定义支持
4. 修改 npm 包 aglio，提供直接在文档 h5 上进行调试
5. 可以根据需要生成所有接口，或者部分接口

示例
--

[](#示例)

1. 结果

    - [![blueprint/1.png](blueprint/1.png)](blueprint/1.png)
    - 可以指定 app\_host，用于发送请求给不同的环境
    - 选择需要的接口调试
    - 直接发请求，支持所有 restful 请求，使用 jquery ajax 实现
    - 需要安装 cros chrome 插件，用于跨域处理
2. composer 添加依赖

    - 依赖内网仓库

        ```
        "repositories": [
            {
                "type": "composer",
                "url": "http://packagist.in66.cc"
            }
        ]

        ```
    - `composer require in/blueprint:dev-master`
    - laravel app 添加 provider

        ```
        // api 工具
        In\Blueprint\Laravel\BlueprintServiceProvider::class,

        ```
3. 文件描写

    - [![blueprint/2.png](blueprint/2.png)](blueprint/2.png)
    - 格式要求比较严格
    - 原始文档，
    - 坑点
        - 多个参数，要加 ',' 区分
        - 注意不能使用 '' 划分
        - @Response 返回的 body 有特殊要求，不支持 \[\] 数组类型，实际开发中，一般是生成一轮文档后，在 h5 页面上请求，能直接得到转换过的值
            - [![blueprint/3.png](blueprint/3.png)](blueprint/3.png)
4. 运行生成命令

    - 生成所有文档，会扫描 app\\Http\\Controllers 里的 所有文件 `php artisan blueprint:generate`
    - 生成单个 controller 的文档，`php artisan blueprint:generate app/Http/Controllers/WechatCorp/WechatCorpController.php`
        - [![blueprint/4.png](blueprint/4.png)](blueprint/4.png)
        - 图示的是生成的文件位置
5. 展示控件安装

    - 需要在内网安装
    - `npm install -g git+ssh://git@githost.in66.cc:yidu/aglio.git`
6. 运行展示

    - 安装后会多了个 aglio 的命令，默认端口 3000，也能生成静态文件
    - `aglio -i storage/api/blueprint.apib -s -h 0.0.0.0`
    - aglio 是基于  修改的

### 持续特性

[](#持续特性)

1. 内部类文档支持，主要是针对 laravel 系列的 job, lisener, facade, service
2. 增加 json schema 的验证
3. 接入到公司的 jenkins 测试中

API Blueprint Generator
=======================

[](#api-blueprint-generator)

[![Build Status](https://camo.githubusercontent.com/fa183f81c4948c3b24173054d10d4fc60c6dbfd173169d546e2227213726f9df/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f64696e676f2f626c75657072696e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/dingo/blueprint)[![License](https://camo.githubusercontent.com/84e43b589cc603ee672bfa240aa515db60cc7aedae2436fa7a432939bc779d5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64696e676f2f626c75657072696e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dingo/blueprint)[![Development Version](https://camo.githubusercontent.com/9e1793e1ba6d96f4be455daf29ebafe77f358e910188ed341e1dcbee31f8cee3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f64696e676f2f626c75657072696e742e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/9e1793e1ba6d96f4be455daf29ebafe77f358e910188ed341e1dcbee31f8cee3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f64696e676f2f626c75657072696e742e7376673f7374796c653d666c61742d737175617265)[![Monthly Installs](https://camo.githubusercontent.com/86babd063f81694a3f00cc3f753ab91cf859e3d2ddf4b783fa55ea385648fbfa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f64696e676f2f626c75657072696e742e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/86babd063f81694a3f00cc3f753ab91cf859e3d2ddf4b783fa55ea385648fbfa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f64696e676f2f626c75657072696e742e7376673f7374796c653d666c61742d737175617265)[![StyleCI](https://camo.githubusercontent.com/96fa9a2392d67cc0992a0dddc93b30d4d01134b5fbae3825d62deb81a99854e7/68747470733a2f2f7374796c6563692e696f2f7265706f732f33373736313038392f736869656c64)](https://styleci.io/repos/37761089)

This package generates a valid API Blueprint 1A document from a collection of classes.

Usage
-----

[](#usage)

Some index method phpdoc example:

```
