如何记录基于 Symfony 的 REST API(类似于阐明文档功能) [英] How to document a Symfony based REST API (similar to enunciate's documentation capabilities)

查看:58
本文介绍了如何记录基于 Symfony 的 REST API(类似于阐明文档功能)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个用 Symfony [symfony-project.org] 框架(即 PHP)编写的基于 REST 的服务,是否有任何合适的工具/框架可以解析我的代码并生成 API 文档?

If I have a REST based service written in the Symfony [symfony-project.org] framework (i.e. PHP), is there any decent tools/frameworks out there that will parse my code and generate API documentation?

基于 Java 的框架 enunciate 具有类似于我需要的文档功能,您可以在此处查看示例:http://enunciate.codehaus.org/wannabecool/step1/index.html.

The Java based framework enunciate has documentation capabilities similar to what I need, you can view an example of this here: http://enunciate.codehaus.org/wannabecool/step1/index.html.

我理解基于 REST 的服务的前提应该是不言而喻的,但是我正在寻找可以为我生成此文档的东西,而无需手动编写我的所有端点、支持的格式、示例输出等.

I understand the premise of REST based services are supposed to be self evident, however I was after something that would generate this documentation for me without the need to manually write up all my endpoints, supported formats, sample output etc.

谢谢

推荐答案

不确定你是否看过 Swagger 之前.他们似乎有一个 PHP 兼容版本,但我不能保证亲自.它会自动生成一些 API 文档,类似于 enunciate,尽管它看起来确实需要通过 PHP 注释进行一些繁重的手动文档.话虽如此,我认为手动工作将与通过 wiki 页面制作您自己的工作相同或更少,并且输出要好得多.

Not sure if you've seen Swagger before. They seem to have a PHP compatible version, though I can't really vouch for it personally. It does some automatic API documentation generation comparable to enunciate, though it does look like it requires some heavy manual documentation via PHP comments. That being said, I think the manual effort will be the same or less than making your own via wiki pages, and the output is much, much nicer.

就像一个事实,看起来Enunciate 有无限期的计划最终支持其他平台,但相关的Jira票 目前正在开放,等待赞助商接手.

Just as a factoid, it looks like Enunciate has indefinite plans to eventually support other platforms, but the relevant Jira ticket is currently Open waiting for a sponsor to take on the work.

来自 ENUNCIATE-356 Jira 票:

支持其他语言的第一步是将 Enunciate 模型与 Java 模型分离.这项工作正在ENUNCIATE-584上进行跟踪和记录.不幸的是,由于它的重量,它从未退出调查阶段.除非找到这项工作的赞助商,否则我预计短期内不会承担这么重的负担.

The first step to supporting other languages is to decouple the Enunciate model from the Java model. This work is being tracked and logged at ENUNCIATE-584. Unfortunately, it never made it out of the investigate phase because of how heavy it is. Unless a sponsor for the work is found, I don't anticipate taking that heavy load on anytime soon.



发现一个类似问题,其中有人提到一个 GitHub 专用于 Swagger+ 的项目Symfony2.另一个问题是一样的,但没有额外的信息.



Found a similar question where someone mentions a GitHub project dedicated to Swagger+Symfony2. This other question is the same, but no additional information.

这篇关于如何记录基于 Symfony 的 REST API(类似于阐明文档功能)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆