apidoc.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <?php
  2. return [
  3. /*
  4. * The type of documentation output to generate.
  5. * - "static" will generate a static HTMl page in the /public/docs folder,
  6. * - "laravel" will generate the documentation as a Blade view,
  7. * so you can add routing and authentication.
  8. */
  9. 'type' => 'static',
  10. /*
  11. * The router to be used (Laravel or Dingo).
  12. */
  13. 'router' => 'laravel',
  14. /*
  15. * The base URL to be used in examples and the Postman collection.
  16. * By default, this will be the value of config('app.url').
  17. */
  18. 'base_url' => null,
  19. /*
  20. * Generate a Postman collection in addition to HTML docs.
  21. * For 'static' docs, the collection will be generated to public/docs/collection.json.
  22. * For 'laravel' docs, it will be generated to storage/app/apidoc/collection.json.
  23. * The `ApiDoc::routes()` helper will add routes for both the HTML and the Postman collection.
  24. */
  25. 'postman' => [
  26. /*
  27. * Specify whether the Postman collection should be generated.
  28. */
  29. 'enabled' => true,
  30. /*
  31. * The name for the exported Postman collection. Default: config('app.name')." API"
  32. */
  33. 'name' => null,
  34. /*
  35. * The description for the exported Postman collection.
  36. */
  37. 'description' => null,
  38. /*
  39. * The "Auth" section that should appear in the postman collection. See the schema docs for more information:
  40. * https://schema.getpostman.com/json/collection/v2.0.0/docs/index.html
  41. */
  42. 'auth' => null,
  43. ],
  44. /*
  45. * The routes for which documentation should be generated.
  46. * Each group contains rules defining which routes should be included ('match', 'include' and 'exclude' sections)
  47. * and rules which should be applied to them ('apply' section).
  48. */
  49. 'routes' => [
  50. [
  51. /*
  52. * Specify conditions to determine what routes will be parsed in this group.
  53. * A route must fulfill ALL conditions to pass.
  54. */
  55. 'match' => [
  56. /*
  57. * Match only routes whose domains match this pattern (use * as a wildcard to match any characters).
  58. */
  59. 'domains' => [
  60. '*',
  61. // 'domain1.*',
  62. ],
  63. /*
  64. * Match only routes whose paths match this pattern (use * as a wildcard to match any characters).
  65. */
  66. 'prefixes' => [
  67. '*',
  68. // 'users/*',
  69. ],
  70. /*
  71. * Match only routes registered under this version. This option is ignored for Laravel router.
  72. * Note that wildcards are not supported.
  73. */
  74. 'versions' => [
  75. 'v1',
  76. ],
  77. ],
  78. /*
  79. * Include these routes when generating documentation,
  80. * even if they did not match the rules above.
  81. * Note that the route must be referenced by name here (wildcards are supported).
  82. */
  83. 'include' => [
  84. // 'users.index', 'healthcheck*'
  85. ],
  86. /*
  87. * Exclude these routes when generating documentation,
  88. * even if they matched the rules above.
  89. * Note that the route must be referenced by name here (wildcards are supported).
  90. */
  91. 'exclude' => [
  92. // 'users.create', 'admin.*'
  93. ],
  94. /*
  95. * Specify rules to be applied to all the routes in this group when generating documentation
  96. */
  97. 'apply' => [
  98. /*
  99. * Specify headers to be added to the example requests
  100. */
  101. 'headers' => [
  102. 'Content-Type' => 'application/json',
  103. 'Accept' => 'application/json',
  104. // 'Authorization' => 'Bearer {token}',
  105. // 'Api-Version' => 'v2',
  106. ],
  107. /*
  108. * If no @response or @transformer declarations are found for the route,
  109. * we'll try to get a sample response by attempting an API call.
  110. * Configure the settings for the API call here.
  111. */
  112. 'response_calls' => [
  113. /*
  114. * API calls will be made only for routes in this group matching these HTTP methods (GET, POST, etc).
  115. * List the methods here or use '*' to mean all methods. Leave empty to disable API calls.
  116. */
  117. 'methods' => ['GET'],
  118. /*
  119. * Laravel config variables which should be set for the API call.
  120. * This is a good place to ensure that notifications, emails
  121. * and other external services are not triggered
  122. * during the documentation API calls
  123. */
  124. 'config' => [
  125. 'app.env' => 'documentation',
  126. 'app.debug' => false,
  127. // 'service.key' => 'value',
  128. ],
  129. /*
  130. * Cookies which should be sent with the API call.
  131. */
  132. 'cookies' => [
  133. // 'name' => 'value'
  134. ],
  135. /*
  136. * Query parameters which should be sent with the API call.
  137. */
  138. 'queryParams' => [
  139. // 'key' => 'value',
  140. ],
  141. /*
  142. * Body parameters which should be sent with the API call.
  143. */
  144. 'bodyParams' => [
  145. // 'key' => 'value',
  146. ],
  147. ],
  148. ],
  149. ],
  150. ],
  151. 'strategies' => [
  152. 'metadata' => [
  153. \Mpociot\ApiDoc\Extracting\Strategies\Metadata\GetFromDocBlocks::class,
  154. ],
  155. 'urlParameters' => [
  156. \Mpociot\ApiDoc\Extracting\Strategies\UrlParameters\GetFromUrlParamTag::class,
  157. ],
  158. 'queryParameters' => [
  159. \Mpociot\ApiDoc\Extracting\Strategies\QueryParameters\GetFromQueryParamTag::class,
  160. ],
  161. 'headers' => [
  162. \Mpociot\ApiDoc\Extracting\Strategies\RequestHeaders\GetFromRouteRules::class,
  163. ],
  164. 'bodyParameters' => [
  165. \Mpociot\ApiDoc\Extracting\Strategies\BodyParameters\GetFromBodyParamTag::class,
  166. ],
  167. 'responses' => [
  168. \Mpociot\ApiDoc\Extracting\Strategies\Responses\UseTransformerTags::class,
  169. \Mpociot\ApiDoc\Extracting\Strategies\Responses\UseResponseTag::class,
  170. \Mpociot\ApiDoc\Extracting\Strategies\Responses\UseResponseFileTag::class,
  171. \Mpociot\ApiDoc\Extracting\Strategies\Responses\UseApiResourceTags::class,
  172. \Mpociot\ApiDoc\Extracting\Strategies\Responses\ResponseCalls::class,
  173. ],
  174. ],
  175. /*
  176. * Custom logo path. The logo will be copied from this location
  177. * during the generate process. Set this to false to use the default logo.
  178. *
  179. * Change to an absolute path to use your custom logo. For example:
  180. * 'logo' => resource_path('views') . '/api/logo.png'
  181. *
  182. * If you want to use this, please be aware of the following rules:
  183. * - the image size must be 230 x 52
  184. */
  185. 'logo' => false,
  186. /*
  187. * Name for the group of routes which do not have a @group set.
  188. */
  189. 'default_group' => 'general',
  190. /*
  191. * Example requests for each endpoint will be shown in each of these languages.
  192. * Supported options are: bash, javascript, php, python
  193. * You can add a language of your own, but you must publish the package's views
  194. * and define a corresponding view for it in the partials/example-requests directory.
  195. * See https://laravel-apidoc-generator.readthedocs.io/en/latest/generating-documentation.html
  196. *
  197. */
  198. 'example_languages' => [
  199. 'bash',
  200. 'javascript',
  201. ],
  202. /*
  203. * Configure how responses are transformed using @transformer and @transformerCollection
  204. * Requires league/fractal package: composer require league/fractal
  205. *
  206. */
  207. 'fractal' => [
  208. /* If you are using a custom serializer with league/fractal,
  209. * you can specify it here.
  210. *
  211. * Serializers included with league/fractal:
  212. * - \League\Fractal\Serializer\ArraySerializer::class
  213. * - \League\Fractal\Serializer\DataArraySerializer::class
  214. * - \League\Fractal\Serializer\JsonApiSerializer::class
  215. *
  216. * Leave as null to use no serializer or return a simple JSON.
  217. */
  218. 'serializer' => null,
  219. ],
  220. /*
  221. * If you would like the package to generate the same example values for parameters on each run,
  222. * set this to any number (eg. 1234)
  223. *
  224. */
  225. 'faker_seed' => null,
  226. /*
  227. * If you would like to customize how routes are matched beyond the route configuration you may
  228. * declare your own implementation of RouteMatcherInterface
  229. *
  230. */
  231. 'routeMatcher' => \Mpociot\ApiDoc\Matching\RouteMatcher::class,
  232. ];