apidoc.php 8.3 KB

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