code-orange/jot
Composer 安装命令:
composer require code-orange/jot
包简介
Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.
README 文档
README
Jot is a Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.
Installation
To install jot with composer:
composer require code-orange/jot
Laravel 5.5+
If you're using Laravel 5.5 or above, the package will automatically register the Jot provider.
Laravel 5.4
Add CodeOrange\Jot\JotServiceProvider::class to the providers array in config/app.php.
Configuration
You can use php artisan vendor:publish to publish the jot configuration to your application:
php artisan vendor:publish --provider=CodeOrange\\Jot\\JotServiceProvider
Then, update config/jot.php.
Usage
Generating documentation
First, document your controller actions with PHPDoc.
class MyController { /** * Returns a value * * This method returns a cool value. * * @param mixed $b Some value * @return JsonResponse { * "a": 1, * "b": "Example" * } */ public function myAction(Request $r) { return response()->json([ 'a' => 1, 'b' => $r->get('b') ]); } }
Then, run php artisan jot:generate.
Markdown documenting your API will be printed to your console.
## Returns a value This method returns a cool value. `GET /example` ### Parameters | Name | Located in | Description | Type | | ---- | ---------- | ----------- | ---- | |b|request|Some value|mixed| |account|path||| ```json { "a": 1, "b": "Example" } ```
You can then add this Markdown to whatever you use to publish your docs. That can just be a Markdown file on GitHub, a wiki, or a self-hosted documentation site.
The Markdown is compatible with lord/slate, which is what we're using at Odyssey to publish our documentation.
Checking documentation coverage
Jot can also check if all of your public API methods are properly documented, for instance as part of your CI test pipeline.
php artisan jot:coverage
will exit with an error status code if there is a method in your API that is not documented.
Optionally, you can use --return to force all methods to have a documented return type/example.
Motivation
This project is heavily inspired by f2m2/apidocs. While that project generates excellent documentation, I didn't like the idea of a Laravel app hosting its own documentation (something that can be done statically and that probably has much different access patterns).
Jot allows you to separate generation and publication of your API docs.
Read more about building Jot in this blogpost.
code-orange/jot 适用场景与选型建议
code-orange/jot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.31k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2017 年 07 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「documentation」 「phpdoc」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 code-orange/jot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 code-orange/jot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 code-orange/jot 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple tool for checking that your PHP classes and methods use PHPDocs (PHP DocBlocks Checker fork).
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
Laravel API documentation generating tool
Validates PHPDoc @param and @return tags against method signatures
A PHPDoc docblock interpreter that is simple, easy to use, and provides Attribute alternatives.
This library parses phpdoc annotations and generates md document that can be parsed by slate
统计信息
- 总下载量: 9.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2017-07-29